Hi ,
am using gridview in a edititemtemplate of the gridview colums am using 3 dropdownlist .. In a Edit mode Based on the one dropdownlist selected value another 2 dropdownlist shold bind .How to do this .. For Example
am binding Product table to gridview. First Colum is Product Code,Second Colum is Product Name, Third Colum is Product Price and Forth colum is Quantity In the Edit mode based on the Selected Product Name colums Dropdownlist .First and Third Colums Dropdownlist will load ..
Can anybody help me to solve this ..
this is my aspx page
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AutoGenerateEditButton="True" CellPadding="4" DataKeyNames="OrdID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" onrowcommand="GridView1_RowCommand" onrowdatabound="GridView1_RowDataBound" onrowediting="GridView1_RowEditing" Width="593px"><RowStyle BackColor="#FFFBD6" ForeColor="#333333" /><Columns><asp:BoundField DataField="OrdID" HeaderText="OrdID" InsertVisible="False" ReadOnly="True" SortExpression="OrdID" Visible="False" /><asp:BoundField DataField="ProductID" HeaderText="ProductID" SortExpression="ProductID" Visible="False" /><asp:TemplateField HeaderText=" Code" SortExpression="ProductCode"><EditItemTemplate><asp:DropDownList ID="DropDownList31" runat="server" DataSourceID="sqldatasource_code" DataTextField="ProductCode" DataValueField="ProductCode"></asp:DropDownList><asp:SqlDataSource ID="sqldatasource_code" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [ProductCode] FROM [Product] WHERE ([ProductName] = @ProductName) and ([ProductRemarks] <> 'Dist')
"><SelectParameters><asp:SessionParameter Name="ProductName" SessionField="Lsz_prdname" /></SelectParameters></asp:SqlDataSource></EditItemTemplate><ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("ProductCode") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Product Name" SortExpression="ProductName"><EditItemTemplate><asp:DropDownList ID="DropDownList30" runat="server" DataSourceID="SqlDataSource_prdname" DataTextField="ProductName" DataValueField="ProductName" AutoPostBack="True" onselectedindexchanged="DropDownList30_SelectedIndexChanged"></asp:DropDownList><asp:SqlDataSource ID="SqlDataSource_prdname" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT Distinct [ProductName], [ProductDiscounts] FROM [Product]WHERE (([ProductRemarks] <> 'Nil') and ([ProductRemarks] <> 'Dist') and ([ProductRemarks] <> 'EXP')) ORDER BY [ProductDiscounts], [ProductName]" CancelSelectOnNullParameter="False"></asp:SqlDataSource></EditItemTemplate><ItemTemplate><asp:Label ID="Label2" runat="server" Text='<%# Bind("ProductName") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Quantity" SortExpression="ProductQty"><EditItemTemplate><asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ProductQty") %>'></asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="Label3" runat="server" Text='<%# Bind("ProductQty") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Basic Price" SortExpression="ProductBasePrice"><EditItemTemplate><asp:DropDownList ID="DropDownList32" runat="server" DataSourceID="SqlDataSource_pricve" DataTextField="ProductBasePrice" DataValueField="ProductBasePrice"></asp:DropDownList><asp:SqlDataSource ID="SqlDataSource_pricve" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [ProductBasePrice] FROM [Product] WHERE ([ProductName] = @ProductName) and ([ProductRemarks] <> 'Dist')" ConflictDetection="CompareAllValues"><SelectParameters><asp:SessionParameter Name="ProductName" SessionField="Lsz_prdname" /></SelectParameters></asp:SqlDataSource></EditItemTemplate><ItemTemplate><asp:Label ID="Label4" runat="server" Text='<%# Bind("ProductBasePrice") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Value" SortExpression="POValue"><EditItemTemplate><asp:TextBox ID="TextBox43" runat="server"></asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="Label5" runat="server" Text='<%# Bind("POValue") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Category" SortExpression="Category" Visible="False"><EditItemTemplate><asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Category") %>'></asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="Label6" runat="server" Text='<%# Bind("Category") %>'></asp:Label></ItemTemplate></asp:TemplateField></Columns><FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /><SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /><HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /><AlternatingRowStyle BackColor="White" /></asp:GridView><br /><br /><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [OrdID], [ProductID], [ProductCode], [ProductQty], [ProductName], [ProductBasePrice], [POValue], [Category] FROM [POTable] WHERE ([PONO] = @PONO)"><SelectParameters><asp:SessionParameter Name="PONO" SessionField="PONO" Type="String" /></SelectParameters></asp:SqlDataSource>
Thanks in advance