value from drop down list based on the filter

Posted by Sharu2789 under C# on 7/4/2012 | Points: 10 | Views : 1268 | Status : [Member] | Replies : 1
i need to selct value from drop down list based on the filter in text box in footer row..




Responses

Posted by: Premalatha on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
<asp:GridView ID="GridViewUsers" runat="server" AutoGenerateColumns="False" CssClass="TableFramed">
<Columns>
<asp:TemplateField HeaderText="Type">
<ItemTemplate>
<asp:DropDownList ID="ddlType" runat="server" AutoPostBack="true">
<asp:ListItem Value="1">Overtime</asp:ListItem>
<asp:ListItem Value="2">Temporary</asp:ListItem>
<asp:ListItem Value="3">Permanent</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="First Name">
<ItemTemplate>
<asp:TextBox ID="txtFName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="FNameValidator" runat="server" Text="*" ControlToValidate="txtFName" Display="Dynamic"></asp:RequiredFieldValidator>
</ItemTemplate>
<asp:TemplateField HeaderText="hide me">
<ItemTemplate>
<asp:TextBox ID="txtHideMe" runat="server"></asp:TextBox>
</ItemTemplate>
</Columns>
</asp:gridview>

code behind

Protected Sub ddlType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
For Each row In GridViewUsers.Rows
Dim reqType As DropDownList = CType(row.FindControl("ddlType"), DropDownList)
Dim txtHideMeAs TextBox = CType(row.FindControl("txtHideMe"), TextBox)

If reqType.SelectedItem.Value = "2" Then
txtHideMe.Visible = "False"
End If
Next
End Sub

Please try it, if u solved your problem, please mail me, and check the anser key

Premalatha
Software Engineer

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

Login to post response