A
AC
I have a DataTable that I'm currently displaying in a DataGrid... but I have the case where I need to use multiple buttons/linkButtons in each row of the DataGrid (in non-edit mode) so I can manually control the sorting and to remove items from the DataTable.
Using template columns, I can easily add buttons to one column and assign them unique ID's, but I can't seem to create the event handlers on the server side. It seems that the codebehind can't understand the unique names of the button names (well, they are unique in the column, but when the control is rendered, they'd all have the same name [I know ASP.NET gives them unique IDs] and I'm just using the CommandArgument to pass the unique value back to me).
In the past, when I've only needed one button, I've just added the Edit button and before the EditCommand method finished, I would just set the EditItemIndex back to -1 so it never got into Edit mode. I knew this was a hack, but it worked and I always meant to revisit this, but never had the time. Well, now I not only have the time, but I'm forced into a corner.
Granted, I might be using the wrong control... maybe I should be using the DataList. Has anyone had this need? I've sort of seen posts about this when people need to add multiple controls to a templte column when in EditMode, but I am not in edit mode.
Thanks
-AC
Using template columns, I can easily add buttons to one column and assign them unique ID's, but I can't seem to create the event handlers on the server side. It seems that the codebehind can't understand the unique names of the button names (well, they are unique in the column, but when the control is rendered, they'd all have the same name [I know ASP.NET gives them unique IDs] and I'm just using the CommandArgument to pass the unique value back to me).
In the past, when I've only needed one button, I've just added the Edit button and before the EditCommand method finished, I would just set the EditItemIndex back to -1 so it never got into Edit mode. I knew this was a hack, but it worked and I always meant to revisit this, but never had the time. Well, now I not only have the time, but I'm forced into a corner.
Granted, I might be using the wrong control... maybe I should be using the DataList. Has anyone had this need? I've sort of seen posts about this when people need to add multiple controls to a templte column when in EditMode, but I am not in edit mode.
Thanks
-AC