Well my datagrid so far has the edit,update,cancel feature and it can get info back from database after entering a number into a textbox.

All i need now is to get it to where I enter a number the data comes up which works and I want a blank row to show up which i can edit and add stuff to.

Any help would be nice. Using asp datagrid and VB as the coding.

Thanks.

Hi!

You should go through this link:
http://www.codeproject.com/KB/webforms/Editable_GridView.aspx

In the link you should consider these parts:

<asp:GridView ID="grdContact" runat="server" 
 AutoGenerateColumns="False" DataKeyNames="Id, Type" 
 OnRowCancelingEdit="grdContact_RowCancelingEdit" 
 OnRowDataBound="grdContact_RowDataBound" 
[B] OnRowEditing="grdContact_RowEditing" [/B]
 OnRowUpdating="grdContact_RowUpdating" ShowFooter="True" 
 OnRowCommand="grdContact_RowCommand" 
 OnRowDeleting="grdContact_RowDeleting">

and this one also:

<asp:TemplateField HeaderText="Name" HeaderStyle-HorizontalAlign="Left"> 
   <EditItemTemplate> 
    <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox> 
   </EditItemTemplate> 
   <FooterTemplate> 
    <asp:TextBox ID="txtNewName" runat="server" ></asp:TextBox> 
   </FooterTemplate> 
   <ItemTemplate> 
    <asp:Label ID="lblName" runat="server" Text='<%# Bind("Name") %>'></asp:Label> 
   </ItemTemplate>
</asp:TemplateField>

and this one is the code behind:

protected void grdContact_RowEditing(object sender, GridViewEditEventArgs e)
{
    grdContact.EditIndex = e.NewEditIndex;
    FillGrid();
}

Thats all C# ive seen ots of C# examples. Im doing mine in VB

ahh thanks man xD I will look at this.

That helped a lot. I got it to add the rows in the footer but they added other columns though. My datagrid is all Bound data. How can i put the row under the correct bound data? Thanks

Hi!

>>>How can i put the row under the correct bound data?
Can you please rephrase the sentence ?

Do you want to edit just a single column OR you are getting column "EDIT" along with "Delete" etc ??

My datagrid is all databound. How can i add a row under the datagrid. That tut allows me to do that but it sets another column. I wanna know how to put the rows under the other rows not start another column and get rid fo my databound datagrid.

I dont know if that explains it. Hard to explain

>>> That tut allows me to do that but it sets another column.

To edit the grid you need to bear this additional column. This column is supported by your GRIDVIEW to edit the record.

>>> I wanna know how to put the rows under the other rows not start another column and get rid fo my databound datagrid.

Additional new row will be add at the end and if you need to edit the record clicking corresponding EDIT button will do the job.

>>> That tut allows me to do that but it sets another column.

To edit the grid you need to bear this additional column. This column is supported by your GRIDVIEW to edit the record.

>>> I wanna know how to put the rows under the other rows not start another column and get rid fo my databound datagrid.

Additional new row will be add at the end and if you need to edit the record clicking corresponding EDIT button will do the job.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.