Hi all,
I'm trying to use the GridView to do an insert, and not sure what I need to do.. I don't work much with ASP.NET controls, so I'm a little confused at it... Heres what I have done
1) Added an LLBLGenDataSource2 control, no worries there.
2) Bound it to a GridView. Ok, now I can delete and edit. Great.
3) I allow my gridview's command button to show an insert. Hmmm, that doesnt't seem to change anything. So I create a template for the insert that calls a method "AddNewRow"..
Here's where I'm stuck. What do I do now? I just want to add a new blank row for insertion, but the grivdiew doesn't seem to do anything
I have so far added this (kludgey?) code to the AddNewRow method:
protected void AddNewRow(object sender, EventArgs e)
{
// I'm going to add my own row to the database (probably stupid idea!)
CandidateEntity candidate = new CandidateEntity();
candidate.Name = "";
candidate.Username = "user";
candidate.Password = "password";
UserManager userManager = new UserManager();
userManager.AddUser(candidate);
// Darn, nothing happens when I call this code, so I'll try this...
GridView1.DataBind(); // This doesn't do anything either
}
As I have it now, it adds a new row to the DB but doesn't reflect in the gridview until I F5 the page! ITs probably dead easy to do this, please, someone put me out of my misery!
Thanks!
And have a good weekend everyone!