Example of gridview in nested modelpopup using asp.net with C#


                                                     Show Gridview data                                                               


                                                     Show Popup data                                                               



  1.                                           Add Record                                                               



                                              Edit Record                                                                

    Nestedpopupmenu.aspx

  2. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="nestedpopupmenu.aspx.cs" Inherits="nestedpopupmenu" %>
  3. <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head id="Head1" runat="server">
  7.     <title></title>
  8.     <style type="text/css">
  9. .modalBackground
  10. {
  11. background-color: Gray;
  12. opacity: 0.50;
  13. filter: alpha(opacity=80);
  14. z-index: 10000;
  15. }
  16. </style>
  17. </head>
  18. <body bgcolor="#3399CC">
  19.    <form id="form1" runat="server">
  20.    <div>
  21.     <asp:ScriptManager ID="ScriptManager1" runat="server">
  22.     </asp:ScriptManager>
  23.         <asp:ModalPopupExtender ID="ModalPopupExtender3" runat="server"
  24.         TargetControlID="Button1"
  25.             PopupControlID="Panel2" BackgroundCssClass="modalBackground">
  26.         </asp:ModalPopupExtender>
  27.         <asp:Button ID="Button1" runat="server" Text="show grid" onclick="Button1_Click" />
  28.         <asp:Panel ID="Panel2" runat="server" BackColor="#3399CC" Visible="false">
  29.         <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
  30.         TargetControlID="LinkButton3"
  31.              PopupControlID="Panel1" BackgroundCssClass="modalBackground">
  32.         </asp:ModalPopupExtender>
  33.         <asp:LinkButton ID="LinkButton3" runat="server" onclick="LinkButton3_Click">add</asp:LinkButton> <br />
  34.         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
  35.                 DataKeyNames="com_id" >
  36.                 <Columns>
  37.                        <asp:TemplateField HeaderText="ID">
  38.                             <ItemTemplate>
  39.                                 <asp:Label ID="Label8" runat="server" Text='<%#Eval("com_id") %>'></asp:Label>
  40.                             </ItemTemplate>
  41.                        </asp:TemplateField>
  42.                        <asp:TemplateField HeaderText="c_nm">
  43.                             <ItemTemplate>
  44.                                 <asp:Label ID="Label7" runat="server" Text='<%#Eval("com_name") %>'></asp:Label>
  45.                             </ItemTemplate>
  46.                        </asp:TemplateField>
  47.                        <asp:TemplateField HeaderText="image">
  48.                                 <ItemTemplate>
  49.                                     <asp:Image ID="Image1" runat="server"  Width="80" Height="80" ImageUrl='<%#Eval("image") %>' />
  50.                                     <asp:Label ID="Label16" runat="server" Text='<%#Eval("image") %>' Visible="false"></asp:Label>
  51.                                 </ItemTemplate>
  52.                        </asp:TemplateField>
  53.                        <asp:TemplateField HeaderText="p_nm">
  54.                             <ItemTemplate>
  55.                                <asp:Label ID="Label9" runat="server" Text='<%#Eval("per_name") %>'></asp:Label>
  56.                             </ItemTemplate>
  57.                        </asp:TemplateField>
  58.                        <asp:TemplateField HeaderText="gender">
  59.                                 <ItemTemplate>
  60.                                     <asp:Label ID="Label13" runat="server" Text='<%#Eval("gender") %>'></asp:Label>
  61.                                 </ItemTemplate>
  62.                        </asp:TemplateField>
  63.                        <asp:TemplateField HeaderText="state">
  64.                             <ItemTemplate>
  65.                                 <asp:Label ID="Label14" runat="server" Text='<%#Eval("state") %>'></asp:Label>
  66.                             </ItemTemplate>
  67.                        </asp:TemplateField>
  68.                        <asp:TemplateField HeaderText="city">
  69.                                 <ItemTemplate>
  70.                                     <asp:Label ID="Label15" runat="server" Text='<%#Eval("city") %>'></asp:Label>
  71.                                 </ItemTemplate>
  72.                        </asp:TemplateField>
  73.                        <asp:TemplateField HeaderText="ph_no">
  74.                             <ItemTemplate>
  75.                                 <asp:Label ID="Label10" runat="server" Text='<%#Eval("com_ph") %>'></asp:Label>
  76.                             </ItemTemplate>
  77.                        <asp:TemplateField HeaderText="mo_no">
  78.                             <ItemTemplate>
  79.                                 <asp:Label ID="Label11" runat="server" Text='<%#Eval("com_mo") %>'></asp:Label>
  80.                             </ItemTemplate>
  81.                        </asp:TemplateField>
  82.                        <asp:TemplateField HeaderText="c_add">
  83.                            <ItemTemplate>
  84.                                 <asp:Label ID="Label12" runat="server" Text='<%#Eval("com_add") %>'></asp:Label>
  85.                             </ItemTemplate>
  86.                        </asp:TemplateField>
  87.                        <asp:TemplateField HeaderText="edit">
  88.                             <ItemTemplate>
  89.                                 <asp:LinkButton ID="LinkButton1" OnClick="edit" runat="server" CausesValidation="False">edit</asp:LinkButton>
  90.                             </ItemTemplate>
  91.                        </asp:TemplateField>
  92.                        <asp:TemplateField HeaderText="delete">
  93.                             <ItemTemplate>
  94.                                 <asp:LinkButton ID="LinkButton2" runat="server" OnClick="delete"  CommandArgument='<%#Eval("com_id") %>' CausesValidation="False">Delete</asp:LinkButton>
  95.                             </ItemTemplate>
  96.                        </asp:TemplateField>
  97.                 </Columns>
  98.             </asp:GridView>
  99.             <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server"
  100.                 TargetControlID="Button5" PopupControlID="Panel1" BackgroundCssClass="modalBackground">
  101.             </asp:ModalPopupExtender>
  102.              <asp:Button ID="Button5" runat="server" Text="Button"  style="display:none" />
  103.           <asp:Panel ID="Panel1" runat="server" BackColor="#3399CC" >
  104.            <table border="1" bordercolor="black">
  105.               <tr>
  106.                 <td>
  107.                     <asp:Label ID="Label6" ForeColor="White" runat="server" Text="company id"></asp:Label>
  108.                 </td>
  109.                 <td>
  110.                     <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
  111.                 </td>
  112.                 <td>
  113.                     <asp:CompareValidator ID="CompareValidator1" runat="server"
  114.           ErrorMessage="only digit is allowed" ControlToValidate="TextBox6" Display="Dynamic"
  115.           Font-Bold="True" Type="Integer" Operator="DataTypeCheck"></asp:CompareValidator>
  116.                     <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter id"
  117.                     ControlToValidate="TextBox6" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>
  118.                 </td>
  119.             </tr>
  120.             <tr>
  121.                 <td>
  122.                     <asp:Label ID="Label1" ForeColor="White" runat="server" Text="company name"></asp:Label>
  123.                 </td>
  124.                 <td>
  125.                     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  126.                 </td>
  127.                 <td>
  128.                     <asp:RequiredFieldValidator ID="rfvFirstName"
  129.                  runat="server"
  130.                  ControlToValidate="TextBox1"
  131.                 ErrorMessage="company Name can't be left blank"
  132.                 Display="Dynamic"> </asp:RequiredFieldValidator>
  133.                 </td>
  134.             </tr>
  135.             <tr>
  136.                 <td>
  137.                     <asp:Label ID="Label7" runat="server" ForeColor="White" Text="enter image"></asp:Label>
  138.                 </td>
  139.                 <td>
  140.                     <asp:FileUpload ID="FileUpload1" runat="server" />
  141.                 </td>
  142.                 <td>
  143.                     <asp:RequiredFieldValidator ID="fileup"
  144.                  runat="server"
  145.                  ControlToValidate="FileUpload1"
  146.                 ErrorMessage="image can't be left blank"
  147.                 Display="Dynamic"> </asp:RequiredFieldValidator>
  148.                 </td>
  149.             </tr>
  150.             <tr>
  151.                 <td>
  152.                    <asp:Label ID="Label2" ForeColor="White" runat="server" Text="persion name"></asp:Label>
  153.                 </td>
  154.                 <td>
  155.                     <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
  156.                 </td>
  157.                 <td>
  158.                     <asp:RequiredFieldValidator
  159.              ID="RequiredFieldValidator2" runat="server"
  160.              ControlToValidate="TextBox2"
  161.              ErrorMessage="person name can't be left blank"
  162.              Display="Dynamic"> </asp:RequiredFieldValidator>
  163.                 </td>
  164.             </tr>
  165.             <tr>
  166.                 <td>
  167.                     <asp:Label ID="Label10" runat="server" ForeColor="White" Text="gender"></asp:Label>
  168.                 </td>
  169.                 <td>
  170.                     <asp:RadioButtonList ForeColor="White" ID="RadioButtonList1" runat="server">
  171.                     <asp:ListItem Text=male Value="male" ></asp:ListItem>
  172.                     <asp:ListItem Text="female" Value="female"></asp:ListItem>
  173.                     </asp:RadioButtonList>
  174.                 </td>
  175.                 <td>
  176.                     <asp:RequiredFieldValidator
  177.              ID="gender" runat="server"
  178.              ControlToValidate="RadioButtonList1"
  179.              ErrorMessage="gender can't be left blank"
  180.              Display="Dynamic"> </asp:RequiredFieldValidator>
  181.                 </td>
  182.             </tr>
  183.             <tr>
  184.                 <td>
  185.                     <asp:Label ID="Label8" ForeColor="White" runat="server" Text="enter state"></asp:Label>
  186.                 </td>
  187.                 <td>
  188.                     <asp:UpdatePanel ID="up1" runat="server">
  189.                     <ContentTemplate>
  190.                         <asp:DropDownList ID="DropDownList1" runat="server"
  191. onselectedindexchanged="DropDownList1_SelectedIndexChanged"
  192.                             DataTextField="statename" DataValueField="statename" AutoPostBack="true"
  193.                             style="height: 22px">
  194.                         </asp:DropDownList>
  195.                     </ContentTemplate>
  196.                     </asp:UpdatePanel>
  197.                 </td>
  198.                 <td>
  199.                     <asp:RequiredFieldValidator
  200.              ID="state" runat="server"
  201.              ControlToValidate="DropDownList1"
  202.              ErrorMessage="state name can't be left blank"
  203.              Display="Dynamic"> </asp:RequiredFieldValidator>
  204.                 </td>
  205.             </tr>
  206.             <tr>
  207.                 <td>
  208.                     <asp:Label ID="Label9"  ForeColor="White" runat="server" Text="enter City"></asp:Label>
  209.                 </td>
  210.                 <td>
  211.                     <asp:UpdatePanel ID="up2" runat="server">
  212.                         <ContentTemplate>
  213.                     <asp:DropDownList ID="DropDownList2"  runat="server" DataTextField="city" AutoPostBack="true" DataValueField="city">
  214.                     </asp:DropDownList>
  215.                     </ContentTemplate>
  216.                     </asp:UpdatePanel>
  217.                 </td>
  218.                 <td>
  219.                     <asp:RequiredFieldValidator
  220.              ID="city" runat="server"
  221.              ControlToValidate="DropDownList2"
  222.              ErrorMessage="city name can't be left blank"
  223.              Display="Dynamic"> </asp:RequiredFieldValidator>
  224.                 </td>
  225.             </tr>
  226.             <tr>
  227.                 <td >
  228.                     <asp:Label ID="Label3" ForeColor="White" runat="server" Text="company phone"></asp:Label>
  229.                 </td>
  230.                 <td >
  231.                     <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
  232.                 </td>
  233.                 <td>
  234.                         <asp:RequiredFieldValidator ID="RequiredFieldValidator4"
  235.              runat="server"
  236.              ControlToValidate="TextBox3"
  237.              ErrorMessage="phoneno can't be left blank"
  238.              SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator>
  239.         <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server"
  240.             ErrorMessage="only number is allowed and 6 digit number" ControlToValidate="TextBox3"
  241.             Display="Dynamic" ValidationExpression="^[0-9]{6}"></asp:RegularExpressionValidator>
  242.                 </td>
  243.             </tr>
  244.             <tr>
  245.                 <td>
  246.                     <asp:Label ID="Label4" ForeColor="White" runat="server" Text="company mobile"></asp:Label>
  247.                 </td>
  248.                 <td>
  249.                     <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
  250.                 </td>
  251.                 <td>
  252.                <asp:RequiredFieldValidator ID="RequiredFieldValidator5"
  253.              runat="server"
  254.              ControlToValidate="TextBox4"
  255.              ErrorMessage="cellno can't be left blank"
  256.              SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator>
  257.         <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
  258.             ErrorMessage="only number is allowed" ControlToValidate="TextBox4"
  259.             Display="Dynamic" ValidationExpression="^[0-9]{10}"></asp:RegularExpressionValidator>
  260.                 </td>
  261.             </tr>
  262.             <tr>
  263.                 <td>
  264.                     <asp:Label ID="Label5" ForeColor="White" runat="server" Text="company address"></asp:Label>
  265.                 </td>
  266.                 <td>
  267.                     <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
  268.                 </td>
  269.                 <td>
  270.                          <asp:RequiredFieldValidator
  271.              ID="RequiredFieldValidator3" runat="server"
  272.              ControlToValidate="TextBox5"
  273.              ErrorMessage="Address can't be left blank"
  274.              Display="Dynamic"> </asp:RequiredFieldValidator>
  275.                 </td>
  276.            </tr>
  277.            <tr>
  278.                 <td>
  279.                     <asp:Button ID="Button4" runat="server" Text="insert" 
  280.                          CausesValidation="False" onclick="Button4_Click"/></td>
  281.                 <td>
  282.                     <asp:Button ID="Button3" runat="server" Text="update"
  283.                        Visible="false" CausesValidation="False" onclick="Button3_Click" />
  284.                        <asp:Button ID="Button2" CausesValidation="false" runat="server" Text="Cancel"
  285.                         onclick="Button2_Click" />
  286.                 </td>
  287.             </tr>
  288.         </table>
  289.         </asp:Panel>
  290.         </asp:Panel>
  291.     </div>
  292.     </form>
  293. </body>
  294. </html>
  295.  
  296.  
  297. nestedpopupmenu.aspx.cs
  298.  
  299. using System;
  300. using System.Collections.Generic;
  301. using System.Linq;
  302. using System.Web;
  303. using System.Web.UI;
  304. using System.Web.UI.WebControls;
  305. using System.Data;
  306. using System.Data.SqlClient;
  307. using System.IO;
  308.  
  309. public partial class nestedpopupmenu : System.Web.UI.Page
  310. {
  311.     protected void Page_Load(object sender, EventArgs e)
  312.     {
  313.         if (!Page.IsPostBack)
  314.         {
  315.             Bind_ddlstate();
  316.         }
  317.     }
  318.     public void Bind_ddlstate()
  319.     {
  320.         string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
  321.         SqlConnection conn = new SqlConnection(con);
  322.         conn.Open();
  323.         string q = "select * from pi_statedemo";
  324.         DataSet ds = new DataSet();
  325.         SqlDataAdapter da = new SqlDataAdapter(q, conn);
  326.         da.Fill(ds);
  327.         DropDownList1.DataSource = ds;
  328.         DropDownList1.DataBind();
  329.         DropDownList1.Items.Insert(0, new ListItem("--select--"));
  330.         // DropDownList2.Items.Insert(0, new ListItem("--select--"));
  331.         //if (DropDownList1.SelectedIndex == -1)
  332.         //{
  333.         //    DropDownList2.SelectedIndex = -1;
  334.         //}
  335.         conn.Close();
  336.     }
  337.     public void Bind_ddlCity()
  338.     {
  339.         //int a = DropDownList1.SelectedIndex + 1;
  340.         //DropDownList2.Items.Clear();
  341.         string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
  342.         SqlConnection conn = new SqlConnection(con);
  343.         conn.Open();
  344.         string q = "select city from pi_citydemo where id ='" + DropDownList1.SelectedIndex + "'";
  345.         DataSet ds = new DataSet();
  346.         SqlDataAdapter da = new SqlDataAdapter(q, conn);
  347.         da.Fill(ds);
  348.         DropDownList2.DataSource = ds;
  349.         DropDownList2.DataBind();
  350.         conn.Close();
  351.     }
  352.     protected void Button4_Click(object sender, EventArgs e)
  353.     {
  354.         string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
  355.         SqlConnection conn = new SqlConnection(con);
  356.         FileUpload1.SaveAs(Server.MapPath("~/image/") + FileUpload1.FileName);
  357.         string k = "~/image/" + FileUpload1.FileName;
  358.         string q = "insert into pi_com2(com_id,com_name,image,per_name,gender,state,city,com_ph,com_mo,com_add) values('" + TextBox6.Text + "','" + TextBox1.Text + "','" + k + "','" + TextBox2.Text + "','" + RadioButtonList1.SelectedValue + "','" + DropDownList1.SelectedValue + "','" + DropDownList2.SelectedValue + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "')";
  359.         SqlCommand cmd = new SqlCommand(q, conn);
  360.         conn.Open();
  361.         int i = cmd.ExecuteNonQuery();
  362.         conn.Close();
  363.         TextBox6.Text = "";
  364.         TextBox1.Text = "";
  365.         TextBox2.Text = "";
  366.         TextBox3.Text = "";
  367.         TextBox4.Text = "";
  368.         TextBox5.Text = "";
  369.         DropDownList1.SelectedIndex = -1;
  370.         Bind_ddlCity();
  371.         RadioButtonList1.SelectedIndex = -1;
  372.         Panel2.Visible = true;
  373.         ModalPopupExtender3.Show();
  374.         grid();
  375.     }
  376.     public void grid()
  377.     {
  378.         string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
  379.         SqlConnection conn = new SqlConnection(con);
  380.         conn.Open();
  381.         string q = "select * from pi_com2";
  382.         DataSet ds = new DataSet();
  383.         SqlDataAdapter da = new SqlDataAdapter(q, conn);
  384.         da.Fill(ds);
  385.         GridView1.DataSource = ds;
  386.         GridView1.DataBind();
  387.         conn.Close();
  388.     }
  389.     protected void edit(object sender, EventArgs e)
  390.     {
  391.         LinkButton lt = (LinkButton)sender;
  392.         GridViewRow rw = (GridViewRow)lt.NamingContainer;
  393.         Label cid = rw.FindControl("Label8") as Label;
  394.         TextBox6.Text = cid.Text;
  395.         Label cnm = rw.FindControl("Label7") as Label;
  396.         TextBox1.Text = cnm.Text;
  397.         Label pnm = rw.FindControl("Label9") as Label;
  398.         TextBox2.Text = pnm.Text;
  399.         Label pno = rw.FindControl("Label10") as Label;
  400.         TextBox3.Text = pno.Text;
  401.         Label mno = rw.FindControl("Label11") as Label;
  402.         TextBox4.Text = mno.Text;
  403.         Label cadd = rw.FindControl("Label12") as Label;
  404.         TextBox5.Text = cadd.Text;
  405.         //TextBox6.ReadOnly = true;
  406.         Label st = rw.FindControl("Label14") as Label;
  407.         DropDownList1.SelectedValue = st.Text;
  408.         Label ct = rw.FindControl("Label15") as Label;
  409.         DropDownList2.Items.Insert(0, (ct.Text));
  410.         Panel2.Visible = true;
  411.         Panel2.Visible = true;
  412.         this.ModalPopupExtender3.Show();
  413.         this.ModalPopupExtender2.Show();
  414.         Button4.Visible = false;
  415.         Button3.Visible = true;
  416.     }
  417.     protected void Button2_Click(object sender, EventArgs e)
  418.     {
  419.          LinkButton3.Visible = true;
  420.          TextBox6.Text = "";
  421.          TextBox1.Text = "";
  422.          TextBox2.Text = "";
  423.          TextBox3.Text = "";
  424.          TextBox4.Text = "";
  425.          TextBox5.Text = "";
  426.          DropDownList1.SelectedIndex = -1;
  427.          Bind_ddlCity();
  428.          RadioButtonList1.SelectedIndex = -1;
  429.          Panel2.Visible = true;
  430.          ModalPopupExtender3.Show();
  431.      }
  432.     protected void delete(object sender, EventArgs e)
  433.     {
  434.         string idb = ((LinkButton)sender).CommandArgument;
  435.         LinkButton st = (LinkButton)sender;
  436.         GridViewRow rw = (GridViewRow)st.NamingContainer;
  437.         Label id = (Label)rw.FindControl("Label18");
  438.         foreach (GridViewRow r in GridView1.Rows)
  439.         {
  440.             string sid = GridView1.DataKeys[r.RowIndex].Values[0].ToString();
  441.             if (sid.Equals(idb))
  442.             {
  443.                 string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
  444.                  SqlConnection conn = new SqlConnection(con);
  445.                  string q = "delete from pi_com2 where com_id='" + sid + "'";
  446.                  SqlCommand cmd = new SqlCommand(q, conn);
  447.                  conn.Open();
  448.                  int i = cmd.ExecuteNonQuery();
  449.                  conn.Close();
  450.              }
  451.          }
  452.          grid();
  453.          Panel2.Visible = true;
  454.          ModalPopupExtender3.Show();
  455.      }
  456.     protected void Button3_Click(object sender, EventArgs e)
  457.     {
  458.         string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
  459.          SqlConnection conn = new SqlConnection(con);
  460.          string s = null;
  461.          if (FileUpload1.HasFile)
  462.         {
  463.              FileUpload1.SaveAs(Server.MapPath("~/image/") + FileUpload1.FileName);
  464.              s = "~/image/" + FileUpload1.FileName;
  465.          }
  466.          else
  467.         {
  468.              foreach (GridViewRow r in GridView1.Rows)
  469.             {
  470.                  string m = GridView1.DataKeys[r.RowIndex].Value.ToString();
  471.                  if (m.Equals(TextBox6.Text))
  472.                 {
  473.                     Label l2 = (Label)GridView1.Rows[r.RowIndex].FindControl("Label16");
  474.                      s = l2.Text;
  475.                  }
  476.              }
  477.          }
  478.         string gender = null;
  479.          if (RadioButtonList1.SelectedIndex == 0)
  480.         {
  481.              gender = "male";
  482.          }
  483.          else if (RadioButtonList1.SelectedIndex == 1)
  484.         {
  485.              gender = "female";
  486.          }
  487.          else
  488.         {
  489.            foreach (GridViewRow r in GridView1.Rows)
  490.             {
  491.                 Label l13 = (Label)GridView1.Rows[r.RowIndex].FindControl("Label13");
  492.                 gender = l13.Text;
  493.             }
  494.         }
  495.         string q = "update pi_com2 set com_name='" + TextBox1.Text + "',image='" + s + "',per_name='" + TextBox2.Text + "',gender='" + gender + "',state='" + DropDownList1.SelectedValue + "',city='" + DropDownList2.SelectedValue + "',com_ph='" + TextBox3.Text + "',com_mo='" + TextBox4.Text + "',com_add='" + TextBox5.Text + "' where com_id='" + TextBox6.Text + "'";
  496.         SqlCommand cmd = new SqlCommand(q, conn);
  497.         conn.Open();
  498.         int i = cmd.ExecuteNonQuery();
  499.         conn.Close();
  500.         TextBox6.Text = "";
  501.         TextBox1.Text = "";
  502.         TextBox2.Text = "";
  503.         TextBox3.Text = "";
  504.         TextBox4.Text = "";
  505.         TextBox5.Text = "";
  506.         DropDownList1.SelectedIndex = -1;
  507.         Bind_ddlCity();
  508.         RadioButtonList1.SelectedIndex = -1;
  509.         Button4.Visible = true;
  510.         Button3.Visible = false;
  511.         Panel2.Visible = true;
  512.         ModalPopupExtender3.Show();
  513.         grid();
  514.     }
  515.     protected void LinkButton3_Click(object sender, EventArgs e)
  516.     {
  517.         Button3.Visible = false;
  518.         Button4.Visible = true;
  519.         Button2.Visible = true;
  520.         //Panel2.Visible = true;
  521.         //Bind_ddlstate();
  522.         //ModalPopupExtender3.Show();
  523.         // GridView1.Style.Add("opacity", "0.4");
  524.         // GridView1.Style.Add("filter", "alpha(opacity=40)");
  525.         Panel1.Visible = true;
  526.         ModalPopupExtender1.Show();
  527.         //Panel1.Style.Add("opacity", "2.0");
  528.         //Panel1.Style.Add("filter", "alpha(opacity=200)");
  529.         // ModalPopupExtender1.Focus();
  530.     }
  531.     protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
  532.     {
  533.         Bind_ddlCity();
  534.     }
  535.     protected void Button1_Click(object sender, EventArgs e)
  536.     {
  537.         Panel2.Visible = true;
  538.         ModalPopupExtender3.Show();
  539.         grid();
  540.     }
  541. }
  542.  
  543.  

1 comment :