<asp:GridView ID="grvStudentDetails" runat="server"
ShowFooter="True" AutoGenerateColumns="False"
CellPadding="4"
GridLines="None" OnRowDeleting="grvStudentDetails_RowDeleting">
<Columns>
<asp:BoundField DataField="RowNumber" HeaderText="" />
<asp:TemplateField HeaderText="From">
<ItemTemplate>
<asp:DropDownList ID="drpQualification" runat="server" >
<asp:ListItem Value="G">kolkata</asp:ListItem>
<asp:ListItem Value="P">Mumbai</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="To">
<ItemTemplate>
<asp:DropDownList ID="drQualification" runat="server">
<asp:ListItem Value="G">Bangalore</asp:ListItem>
<asp:ListItem Value="P">Delhi</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Travel Date">
<ItemTemplate>
<asp:TextBox ID="txtAddress" runat="server" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate>
<asp:Button ID="ButtonAdd" runat="server"
Text="Add New City" OnClick="ButtonAdd_Click" />
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
我的asp页面中有以下gridview,现在我想通过单击保存按钮将这个gridview的所有内容表示从、到、日期等连接到我的数据库,我将如何做到这一点,我必须做什么在我的 .cs 文件中执行。PLZZZ 帮助
protected void Button1_Click(object sender, EventArgs e)
{
string insrt = "insert into book_mas_det(book_date,book_from,book_to,travel_date,return_date,adult_pax,child_pax,travel_class,contact_name,pnr_no,tot_amt,adv_amount,travler_rmks,agent_rmks) values (@a,@b,@c,@d,@e,@f,@g,@h,@i,@j,@k,@l,@m,@n)";
MySqlCommand cmd = new MySqlCommand(insrt, conn);
cmd.Parameters.AddWithValue("@a", txtbookingdate.Text);
cmd.Parameters.AddWithValue("@b", ddlfrom.SelectedItem.Text);
cmd.Parameters.AddWithValue("@c", ddlto.SelectedItem.Text);
cmd.Parameters.AddWithValue("@d", txtdeprtr.Text);
cmd.Parameters.AddWithValue("@e", txtreturn.Text);
cmd.Parameters.AddWithValue("@f", txtadult.Text);
cmd.Parameters.AddWithValue("@g", txtchild.Text);
cmd.Parameters.AddWithValue("@h", ddlclass.SelectedItem.Text);
cmd.Parameters.AddWithValue("@i", txtcontpername.Text);
cmd.Parameters.AddWithValue("@j", txtcontmobile.Text);
cmd.Parameters.AddWithValue("@k", txtamnttocharge.Text);
cmd.Parameters.AddWithValue("@l", txtadvamnt.Text);
cmd.Parameters.AddWithValue("@m", txtcmnttrav.Text);
cmd.Parameters.AddWithValue("@n", txtcmntagnt.Text);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
string display = "Booking Details is added successfully";
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + display + "');", true);
我已经为 view1 连接添加了我的 .cs 代码,现在如何为 view2 和 view3 进行连接