3
Answers

GridView Dropdown control's event cannot access in ASP.NET

Bineesh  VP

Bineesh VP

9y
619
1
Sir,
 
I have  in the problem of cannot write GridView DropdownList SelectIndexChanged Event in ASP.NET.
 
I cannot click on the DropdownList Control and to invoke SelectIndex Changed Event. get selected the GridView  wholly.
 
I cannot access a individual control inside the gridview. Please help me on this difficulty 
 
GridView looks like this:-
 
 
 
and the html code is:-
 
HTML CODE START
 
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ShowHeaderWhenEmpty="True"
GridLines="None" AutoGenerateColumns="False"
onrowdatabound="GridView1_RowDataBound" ForeColor="#333333"
>
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="S.L.No">
<ItemTemplate>

<%#Container.DataItemIndex+1 %>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Customer">
<ItemTemplate>
<asp:DropDownList ID="ddlCustomerName" Width="150px" AppendDataBoundItems="true" runat="server">
</asp:DropDownList>
</ItemTemplate>
<EditItemTemplate>

<asp:DropDownList ID="ddlEditCustomer" Width="150px" runat="server">

</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
<ItemTemplate>
<asp:TextBox ID="txtDate" runat="server" Width="70px"></asp:TextBox>
<Ajax:CalendarExtender ID="AjaxCalender" TargetControlID="txtDate" runat="server"></Ajax:CalendarExtender>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditDate" runat="server"></asp:TextBox>
<Ajax:CalendarExtender ID="AjaxEditCalender" runat="server" TargetControlID="txtEditDate"></Ajax:CalendarExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Item">
<ItemTemplate>
<asp:DropDownList ID="ddlProduct" runat="server" Width="150px" AutoPostBack="true">
</asp:DropDownList>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlEditProduct" runat="server">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Qty">
<ItemTemplate>
<asp:TextBox ID="txtQty" runat="server" Width="50px"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditQty" runat="server" Width="50px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Rate">
<ItemTemplate>
<asp:TextBox ID="txtRate" runat="server" Width="70px"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditRate" runat="server" Width="70px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Disc">
<ItemTemplate>
<asp:TextBox ID="txtDisc" runat="server" Width="90px"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditDiscount" runat="server" Width="90px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total Amount">
<ItemTemplate>
<asp:TextBox ID="txtTotalAmount" runat="server" Width="120px"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditTotalAmount" runat="server" Width="120px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Columns>

<EditRowStyle BackColor="#7C6F57" />

<FooterStyle BackColor="#1C5E55" ForeColor="White" Font-Bold="True" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView> 
 
HTML CODE END
 
 
 
 
Answers (3)