I currently have an ASP DataGrid with a ButtonColumn in it, like this:-
<asp:DataGrid id="gradesGrid"
AutoGenerateColumns="true"
runat="server"
OnSelectedIndexChanged="GradesDataGridSelectedCallback">
<Columns>
<asp:ButtonColumn HeaderText=""
ButtonType="LinkButton"
Text="Graph"
CommandName="Select">
</asp:ButtonColumn>
</Columns>
</asp:DataGrid>
and this works perfectly; when the button column is clicked, the GradesDataGridSelectedCallback
function is invoked and all is marvellous. I now need to add a second button column to this data grid, to perform a different function related to the grid item. I add the extra code:-
<asp:ButtonColumn HeaderText=""
ButtonType="LinkButton"
Text="Display"
CommandName="NewFunction">
</asp:ButtonColumn>
This displays as expected but clicking the second button (although it causes a post-back), doesn't invoke the GradesDataGridSelectedCallback
function. The question is, how to I wire up this second ButtonColumn to a particular function in the C# codebehind?
Alternatively, if I specify the button column so:-
<asp:ButtonColumn HeaderText=""
ButtonType="LinkButton"
Text="Display"
CommandName="Select">
</asp:ButtonColumn>
then the GradesDataGridSelectedCallback
does get invoked, but I can't see any way of determining which ButtonColumn was clicked. Is there a way, and if so what is it?