Actually, this is not a demo but an example! Following is a part of ASP.NET/C# code
for handling HTTP posted values of
appendGrid. Click
here for more information about
`uniqueIndex`.
// Prepare database connection
SqlConnection dbConn = new SqlConnection("[Your connection string here!]");
dbConn.Open();
// Split the `rowOrder` which is the array of `unique index`
string[] uniqueIndexes = Request.Form["tblAppendGrid_rowOrder"].Split(',');
// Process on each row by using for-loop
for (int row = 0; row ‹ uniqueIndexes.Length; row++)
{
// Get the posted values by using `grid ID` + `column name` + `unique index` syntax
string album = Request.Form["tblAppendGrid_Album_" + uniqueIndexes[row]];
string artist = Request.Form["tblAppendGrid_Artist_" + uniqueIndexes[row]];
// Do whatever to fit your needs, such as save to database
SqlCommand dbCmd = dbConn.CreateCommand();
dbCmd.CommandText = "INSERT INTO [MyAlbum] ([RecordNumber],[AlbumName],[Artist]) VALUES (@RecordNumber,@AlbumName,@Artist);";
dbCmd.Parameters.AddWithValue("@RecordNumber", row + 1);
dbCmd.Parameters.AddWithValue("@AlbumName", album);
dbCmd.Parameters.AddWithValue("@Artist", artist);
dbCmd.ExecuteNonQuery();
}
Show Source Code