ADD Feature to a Gridview

C

crocboy25

Hello Group,

I am have been trying to include an "ADD" record feature to the top of
a gridview with no luck as far. Does anyone have any method that they
know of will work for this? I have googled for days without finding
anything that has been effective as of yet.

Any help would be greatly appreciated.

Thanks
 
Joined
Oct 1, 2010
Messages
1
Reaction score
0
Add a linkbutton

<asp:LinkButton ID="lblNew" runat="server" CausesValidation="false"
CommandName="Insert"
Text="Click here to add new" style="vertical-align: middle; text-align:
center" Font-Bold="False" ForeColor="Black"
OnClick="GridViewInsert">
</asp:LinkButton>

In the .cs page add:

protected void GridViewInsert(object sender, EventArgs e)
{
SqlDataSource1.Insert();
}

How the above works:
Adds an extra row in the gridview. on click of the above linkbutton, the function GridViewInsert is called which simply inserts a row in the Gridview.
Note: An empty row will be inserted. To add data in the row you need to add the Edit, Update CommandFeild. We're just working around a solution since there's no Add functionality in a Gridview the way it has Edit, Update.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top