I am new to these controls and am missing the boat somewhere. I am trying to get the value of a specific cell when youclick the cell. I have just dropped a radgrid onto the page and configured it to a sqldatasource. I made one of the columns a button column using a link. I read through the Accessing Cells and Rows docs and added the following code to try to use the UniqueName to extract the value.
Using RadGrid
I am not sure if I have set up the radgrid correctly or if I am using the correct event. I want to convert a .net grid to a radgrid and used the RowCommand event in the .net grid to extract the values which is something like this.
Using ASP.Net Grid
Using RadGrid
| Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound |
| 'e is the event argument object |
| If TypeOf e.Item Is GridDataItem Then |
| Dim dataItem As GridDataItem = CType(e.Item, GridDataItem) |
| Dim cell As TableCell = dataItem("UserName") |
| Dim celltxt As String = cell.Text |
| lblCell.Text = celltxt |
| End If |
| End Sub |
I am not sure if I have set up the radgrid correctly or if I am using the correct event. I want to convert a .net grid to a radgrid and used the RowCommand event in the .net grid to extract the values which is something like this.
Using ASP.Net Grid
| Protected Sub gvManageSales_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvManageSales.RowCommand |
| ' CommandName property to determine which button was clicked. |
| If e.CommandName = "SalesID" Then |
| ' Convert the row index stored in the CommandArgument |
| ' property to an Integer. |
| Dim index As Integer = Convert.ToInt32(e.CommandArgument) |
| ' Retrieve the row that contains the button clicked |
| ' by the user from the Rows collection. |
| Dim row As GridViewRow = gvManageSales.Rows(index) |
| ' Create a new ListItem object for the contact in the row. |
| Dim UName As New ListItem() |
| UName.Text = Server.HtmlDecode(row.Cells(1).Text) |
| 'Display name etc. |
| lblName.text = UName |
| End If |
| End Sub |
Any ideas on how to acheive this in the radgrid.