Click here to Skip to main content
14,304,697 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hy I want to bind daa in gridview using C# and I want auto edit also Please help me

.aspx File

<form id="form1" runat="server">
     <asp:GridView ID="GridView1" Width="50%" runat="server" CellPadding="2" ForeColor="#333333" GridLines="None">
         <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
         <EditRowStyle BackColor="#999999" />
         <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
         <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
         <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
         <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
         <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
         <SortedAscendingCellStyle BackColor="#E9E7E2" />
         <SortedAscendingHeaderStyle BackColor="#506C8C" />
         <SortedDescendingCellStyle BackColor="#FFFDF8" />
         <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
             <asp:CommandField ShowEditButton="True" />
          <asp:SqlDataSource ID="" runat="server" ConnectionString="<%$ ConnectionStrings:CMMS_Standard %>" ProviderName="<%$ ConnectionStrings:CMMS_Standard.ProviderName %>" SelectCommand="SELECT * FROM [Currency_Table]" DeleteCommand="DELETE FROM [Currency_Table] WHERE [Currency_Id] = @Currency_Id" InsertCommand="INSERT INTO [Currency_Table] ([Currency_Id], [Currency_Name], [Currency_Code], [Country_Name]) VALUES (@Currency_Id, @Currency_Name, @Currency_Code, @Country_Name)" UpdateCommand="UPDATE [Currency_Table] SET [Currency_Name] = @Currency_Name, [Currency_Code] = @Currency_Code, [Country_Name] = @Country_Name WHERE [Currency_Id] = @Currency_Id">
             <asp:Parameter Name="Currency_Id" Type="Byte" />
             <asp:Parameter Name="Currency_Id" Type="Byte" />
             <asp:Parameter Name="Currency_Name" Type="String" />
             <asp:Parameter Name="Currency_Code" Type="String" />
             <asp:Parameter Name="Country_Name" Type="String" />
             <asp:Parameter Name="Currency_Name" Type="String" />
             <asp:Parameter Name="Currency_Code" Type="String" />
             <asp:Parameter Name="Country_Name" Type="String" />
             <asp:Parameter Name="Currency_Id" Type="Byte" />


string Connection_string = System.Configuration.ConfigurationManager.ConnectionStrings["CMMS_Standard"].ToString();

   protected void Page_Load(object sender, EventArgs e)
       DataTable dt = null;
       Test t = new Test();
       t.Retrieve_Currency_By_All(ref Connection_string, out dt);
       GridView1.DataSource =dt ;

Now I want autorow edit Option
Updated 3-Apr-15 1:01am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100