Hi guys
I have gone though the help section how to access rows and columns to do this but all key returns is ' ' The table has data and is populating that column with data. Any Ideas what I am doing wrong?
<telerik:GridBoundColumn DataField="Tariff ID" HeaderText="Tariff ID"
SortExpression="Tariff ID" UniqueName="TariffID">
</telerik:GridBoundColumn>
and in code
Protected Sub RadGridMain_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGridMain.ItemCreated
If TypeOf e.Item Is GridDataItem Then
Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
Dim key As String = dataItem("TariffID").Text
....
....
9 Answers, 1 is accepted
0

Mark
Top achievements
Rank 1
answered on 15 Mar 2009, 07:57 AM
Anyone have any ideas?
0
Accepted

Princy
Top achievements
Rank 2
answered on 16 Mar 2009, 04:27 AM
Hello Mark,
Try out the same code in the ItemDataBound event of the grid, since the ItemCreated event is too early to access the text of a cell and hence the cell text gets rendered as ' '.
-Princy.
Try out the same code in the ItemDataBound event of the grid, since the ItemCreated event is too early to access the text of a cell and hence the cell text gets rendered as ' '.
-Princy.
0

Mark
Top achievements
Rank 1
answered on 16 Mar 2009, 06:39 AM
Thanks so much princy Works 100% :D
0

Steve Napurano
Top achievements
Rank 1
answered on 12 Nov 2009, 11:37 PM
Hi, I am receiving a in my Item_Command event when I access a cell with a value. I access it this way...'e.Item.cells(0).Text'.
Ive read a lot about 'Too early' etc. When the user clicks my 'Add To Cart' button in the grid, the item_command fires, I need to access a drop down list value in the grid and the part number in a basic cell.
Why am I getting ????
Any help is appreciated
Thanks
Steve
Ive read a lot about 'Too early' etc. When the user clicks my 'Add To Cart' button in the grid, the item_command fires, I need to access a drop down list value in the grid and the part number in a basic cell.
Why am I getting ????
Any help is appreciated
Thanks
Steve
0

Princy
Top achievements
Rank 2
answered on 13 Nov 2009, 05:36 AM
Hello Steve,
You can access cell values using the UniqueName of the columns. Here's an example of how to get this done:
c#:
Thanks
Princy.
You can access cell values using the UniqueName of the columns. Here's an example of how to get this done:
c#:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == "AddToCart") |
{ |
GridDataItem dataItem = (GridDataItem)e.Item; |
DropDownList ddl = (DropDownList)dataItem.FindControl("DropDownListID"); |
string ddlText = ddl.Text; |
string strtxt = dataItem["ColumnUniqueName"].Text; |
} |
} |
Thanks
Princy.
0

Steve Napurano
Top achievements
Rank 1
answered on 13 Nov 2009, 05:47 AM
HI. I converted it to vb, neither attempts work, I get " " returned.
Dim dataItem As GridDataItem
dataItem =
DirectCast(e.Item, GridDataItem)
Dim ddl As DropDownList
ddl =
DirectCast(dataItem.FindControl("ddlQuantity"), DropDownList)
Dim qty As String = ddl.SelectedItem.Text (Doesnt work)
Dim qty2 As String = ddl.Text (Doesnt work)
I am certain there are values in the list and I am certain I selected a value. Funny, after I select a value and click 'add to cart' the value in the list defaults back to 'No selection' it does not save the selected value. I am thinking the list is switching back to its default value before the procedure can get to it.
very frustrating, any other ideas. My client is on my back about this.
Thanks
0

Steve Napurano
Top achievements
Rank 1
answered on 14 Nov 2009, 06:30 AM
Hi, any other ideas. This is quite strange. Why cant i retrieve the value and why does the list revert back to selectedindex of 0 after the add to cart command/procedure is run/
Please help
Please help
0

Steve Napurano
Top achievements
Rank 1
answered on 14 Nov 2009, 06:47 AM
HI, Im still playing with the code but its very basic. Its obvious that the grid is reloading and setting the drop down to default selectedindex to and by the time the procedure is run, the value in the drop down list has changed.
I tried asp dropdownlist and radcombo, same problem.
Any ideas?
I tried asp dropdownlist and radcombo, same problem.
Any ideas?
0

Steve Napurano
Top achievements
Rank 1
answered on 14 Nov 2009, 07:43 AM
Disregard this thread