how to clear textbox which is in grid

Posted by Srinu0411 under Regular Expressions on 3/4/2010 | Views : 3735 | Status : [Member] | Replies : 1
i have dropdownlist which contains options like(2,3,4)
gridview contains textbox
<asp:GridView ID="GrdOptions" runat="server" AutoGenerateColumns="False" Width="212px" >

<asp:TemplateField HeaderText="Option" HeaderStyle-HorizontalAlign="Center">
<asp:TextBox ID="txtText" runat="server" MaxLength="2000" Width="250px"></asp:TextBox>
Depending on dropdown options gridview will open
if ddlist is 2 then
gridview will open 2 textboxs

1)now how to clear textboxs in grid
2)ho to keep validation
if ddlist is 3, gridview will open 3 textboxs
if i fill 3 textboxs it is ok but if 0 or 1 or 2 it should show message in label or messagebox to fill all options

kaja srinivas


Posted by: Vuyiswamb on: 3/5/2010 [Member] [MVP] [Administrator] NotApplicable

i have few Questions for you.

When do you want to Clear the Textboxes ?

To Clear the Textbox you can iterate through the Grid and find the Controls and set their Text Property to an empty string.

When you say keep Validation am not sure what you mean, maybe you can elaborate on that part.

Thank you for posting at Dotnetfunda

Srinu0411, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response