You must Sign In to post a response.
  • Category: ASP.NET

    How to make datepicker controls value to blank and reset textboxes?

    Are you looking for a way to make datepicker controls value to blank and reset textboxes ? then read this thread to know more about it

    I have created a one form.In that form I am using gms datepicker control.User can fill form and onreset button I want to clear all textboxes and datepicker control.I am able to clear textbox control but not datepicker control.How to do that?There are 5 section in my web page.Reset button is only for one section.I dont want redirect to same page on reset button.If I do like this,user can loose all 4 section value.I dont want to do that.
  • #732096
    You need to code for it may be using javascript, it is client side scripting and avoid your postback.
    see below code to clear perticular textboxes

    <script language="javascript">
    function clearMe()
    //give textbox id and make it clear
    document.getElementById("txtBox1").value= "";
    document.getElementById("txtBox2").value= "";

    //give return false to avoid postback
    return false;
    //call this function on reset button click
    <asp:Button id="restButton" runat="server" text="Reset" />

    hope it helps

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #732098

    Your question is not clear for making datepicker control's value to blank?

    Because will not have any datepicker control, it has only calender control. I think you might be using either javascript datepicker or Jquery datepicker.

    Try like this
    -> Set Date Formate to be "CUSTOM"
    -> Then CustomFormate = " " (Single Space)

    dateTimePicker1.Format = DateTimePickerFormat.Custom;
    //with-in quotes add one whitespace
    dateTimePicker1.CustomFormat = " ";

    Thanks & Regards,
    Mahesh Durgam

  • #732109
    I am using gm datepicker control...It does have custom format property.
    <cc1:GMDatePicker ID="GMDatePicker1" runat="server" >

  • Sign In to post your comments