Author: dkaur76 | Posted on: 6/25/2009 2:01:56 PM | Views : 290

I want a 'delete' asp link button created dynamically, for each record that I display in my table. I am getting a compilation error. I guess I am mixing client-side and server-side calls. All I want to do is when the user clicks 'Delete' on btnLnk it should run this command: DeleteRecord(bloodGlucose.Key.Id.ToString());
Error    1    Cannot implicitly convert type 'void' to 'string'  on line 5 
Here is my code, please check and suggest correction:
1. TableCell deleteCell = new TableCell();
2. LinkButton btnLnk = new LinkButton();
3. btnLnk.Text = "Delete";
4. btnLnk.Visible = true;
5. btnLnk.CommandName = DeleteRecord(bloodGlucose.Key.Id.ToString());
6. deleteCell.HorizontalAlign = HorizontalAlign.Center;
7. row.Cells.Add(deleteCell);
 
15. void DeleteRecord(String KeyID)
16.    {
17.    & ...

Go to the complete details ...