girmachew gulint

girmachew gulint

  • NA
  • 85
  • 1.8k

Insert Multiple rows in gridview.

Dec 15 2019 9:29 AM
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="crit_cat_id,crit_sub_cat_id,criteria_id" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="crit_cat_id" HeaderText="crit_cat_id" InsertVisible="False" ReadOnly="True" SortExpression="crit_cat_id" Visible="false" />
<asp:BoundField DataField="name" HeaderText="name" SortExpression="name" Visible="false" />
<asp:BoundField DataField="crit_sub_cat_id" HeaderText="crit_sub_cat_id" InsertVisible="true" ReadOnly="True" SortExpression="crit_sub_cat_id" Visible="false" />
<asp:BoundField DataField="crit_cat_id1" HeaderText="crit_cat_id1" SortExpression="crit_cat_id1" Visible="false" />
<asp:BoundField DataField="category_title" HeaderText="category_title" SortExpression="category_title" Visible="false" />
<asp:BoundField DataField="criteria_id" HeaderText="criteria_id" InsertVisible="true" ReadOnly="True" SortExpression="criteria_id" />
<asp:BoundField DataField="crit_cat_id2" HeaderText="crit_cat_id2" SortExpression="crit_cat_id2" Visible="false" />
<asp:BoundField DataField="crit_sub_cat_id1" HeaderText="crit_sub_cat_id1" SortExpression="crit_sub_cat_id1" Visible="false" />
<asp:BoundField DataField="criteria" HeaderText="criteria" SortExpression="criteria" />
<asp:TemplateField HeaderText="Scale">
<ItemTemplate>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
<asp:ListItem>Excellent</asp:ListItem>
<asp:ListItem>Very Good</asp:ListItem>
<asp:ListItem>Good</asp:ListItem>
<asp:ListItem>Fair</asp:ListItem>
<asp:ListItem>Poor</asp:ListItem>
<asp:ListItem>NA</asp:ListItem>
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DBUIPESConnection %>" SelectCommand="SELECT tbl_criteria_category.*, tbl_criteria_title.*, tbl_criteria.* FROM tbl_criteria_category, tbl_criteria_title, tbl_criteria WHERE tbl_criteria_category.crit_cat_id = tbl_criteria_title.crit_cat_id and tbl_criteria_title.crit_sub_cat_id = tbl_criteria.crit_sub_cat_id and tbl_criteria_category.crit_cat_id=' 1 '"></asp:SqlDataSource>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Bulk_Insert" Text="Bulk Insert" />
 
<br />
 
 
I have populated the gridview from 3 tables and add radiobuttonlist in aspx file corsponding to the criteria populated from the table.
The question is how to Save all values of corsponding criteria after clicked the button? (Multiple rows of criteria single radiobuttonlist)
 
Thanks. 

Answers (1)