Clearing values in WebControls

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Clearing values in WebControls

    Hi folks,

    I have a form with ASP.NET web controls.
    At the end of the form there's the "Clear" button to clear the available
    values and start over.
    How do I do that?
    The following did not work because it unloaded the controls, and not just
    clearing the values:
    - this.Controls.Clear();

    How do I do it easily? For example, the following pseudo is what I want to
    accomplish:
    - foreach (control in myControlCollection)
    control.ClearValue();
    or the following is just as acceptable since there are only a few control
    type:
    - foreach (control in myControlCollection)
    type = control.GetType()
    switch type
    case 'DropDownList':
    control.Remove.Item();
    case 'TextBox':
    control.Text = "";
    etc. etc.

    What I don't want to do is to have to type in each control instance name and
    reset the values one by one.
    Is this possible?
    If yes, would you please write a small example or point me to a MS:Help
    file/page you found that in.
    Thanks very much.

    - js.


    John Smith Guest

  2. Similar Questions and Discussions

    1. Refering to <asp:> webcontrols
      Hey, Question, how can i create client-side javascript that refers to a asp.net webcontrol. For example set the focus of a textbox lik this. ...
    2. Serious issues with webcontrols...
      Hi, First of all, sorry for cross-posting, but some groups look more active than others, and I sure need to find an answer to this. I recently...
    3. IE WebControls
      Hi, Downloaded IEWebControls.exe application & run on local machine O/S: Win Advance Server 2000 Framework: 1.1 Notes: * During installation...
    4. IE Webcontrols - Tabstrip
      So has anyone worked with the IE webcontrols much? I've found that they've come in very handy for Internet Explorer clients ... ON A WINDOWS...
    5. WebControls Button
      I have 2 HTML buttons and 1 WebControls Button on my page. I have set the 'CausesValidation' attribute of my WebControls button to False in the...
  3. #2

    Default Re: Clearing values in WebControls

    John Hi,

    Did you consider using the old (HTML) Reset button?

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!

    Natty Gur Guest

  4. #3

    Default Re: Clearing values in WebControls

    Doooooh!!!
    Much thanks Nat.
    I feel so silly.

    -js

    "Natty Gur" <natty@dao2com.com> wrote in message news:OARxOsfPDHA.3152@TK2MSFTNGP10.phx.gbl...
    John Hi,

    Did you consider using the old (HTML) Reset button?

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!

    John Smith Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139