DataGrid Assistance
-
I am using ASP.NET to create this datagrid, but I am trying to do all of the code in the VB code section and not the html section. I am building a datagrid as follows: 3 Text Columns 1 Link Button Column 1 Push Button Column In Property Builder, I have set the "Command Name" for both the Link Button and Push Button columns to "Select". This is so that when the user clicks on the column, I can use the SelectedIndexChange event and determine what row they are clicking on. The only problem is that in doing so, I cannot determine the column they are clicking on. Is there any code I can use on the VB side in the datagrid SelectedIndexChange sub to determine what column was clicked in? Anything from the header of the column or even just the column index itself. The SelectedIndexChange sub is written such: Private Sub dg_LastSevenDays_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dg_LastSevenDays.SelectedIndexChanged End Sub When I try to see what data I can get from 'sender' or 'e', all they reference is the datagrid itself and not anything within it. Search for solutions online, I found a few that would work if this was a compiled application and not a web application. Has anyone run into this before? David
-
I am using ASP.NET to create this datagrid, but I am trying to do all of the code in the VB code section and not the html section. I am building a datagrid as follows: 3 Text Columns 1 Link Button Column 1 Push Button Column In Property Builder, I have set the "Command Name" for both the Link Button and Push Button columns to "Select". This is so that when the user clicks on the column, I can use the SelectedIndexChange event and determine what row they are clicking on. The only problem is that in doing so, I cannot determine the column they are clicking on. Is there any code I can use on the VB side in the datagrid SelectedIndexChange sub to determine what column was clicked in? Anything from the header of the column or even just the column index itself. The SelectedIndexChange sub is written such: Private Sub dg_LastSevenDays_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dg_LastSevenDays.SelectedIndexChanged End Sub When I try to see what data I can get from 'sender' or 'e', all they reference is the datagrid itself and not anything within it. Search for solutions online, I found a few that would work if this was a compiled application and not a web application. Has anyone run into this before? David
Look at the Checkboxes and Textboxes section
DataGridItem Item = (DataGridItem)(((System.Web.UI.Control)sender).NamingContainer);
Though it isn't exactly what you asked for, it should give you enough clues. http://www.codeproject.com/KB/webforms/datagriddemo.aspx[^]
only two letters away from being an asset