Hello,
In my codebehind I am creating a Radgrid and adding the columns to the grid. One of those columns is a GridButtonColumn. The code looks like so...
| Dim clmbtnGRDMAIN1 As New Telerik.Web.UI.GridButtonColumn |
| clmbtnGRDMAIN1.DataTextField = rowCOLUMN.FIELDNAME |
| clmbtnGRDMAIN1.HeaderText = rowCOLUMN.EXTERNAL_READABLE1 |
| clmbtnGRDMAIN1.UniqueName = rowCOLUMN.FIELDNAME |
| clmbtnGRDMAIN1.HeaderStyle.Width = rowCOLUMN.GRIDWIDTH |
| clmbtnGRDMAIN1.CommandName = "TEMPID" |
| grdMAIN1.Columns.Add(clmbtnGRDMAIN1) |
This works fine, it creates the button with the proper information. But what I want to do, is that after a user clicks on the link button, gather the value.
The Telerik example says to put some code in the ItemCreated event. Such as this...
| If e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Then |
| Dim item As Telerik.Web.UI.GridDataItem |
| item = e.Item |
| Dim LinkButton1 As LinkButton |
| LinkButton1 = item("TEMPID").Controls.Item(0) |
| LinkButton1.CommandArgument = e.Item.ItemIndex.ToString() |
| End If |
This works and the index is correct.
But, when I try to get the value in the ItemCommand event, I get nothing. The code is here...
| Dim index As Integer = Convert.ToInt32(e.CommandArgument) |
| Dim item As Telerik.Web.UI.GridDataItem = grdMAIN1.Items(index) |
And if I then do a Response.Write(item("TEMPID").Text, -1) it comes up with a space when it should contain a string of numbers.
Anyone have any idea what I'm doing wrong or how I can get this value properly? I'm having a heck of a time trying to do this. I feel as though it should be easier to get a value out of a link.
Thanks
Kevin