This is a migrated thread and some comments may be shown as answers.

Extracting Value from grid and pass it to a session

7 Answers 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 03 Mar 2009, 02:10 PM
hi

This is my grid value of the first column:

CustomerName
Allen
Ben
Charlie

I would like to extract the first character and pass it to a session. For example "Allen", Session("value") = "A".  "Ben", Session("value") = "B".  How should i go about it? thanks

7 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Mar 2009, 02:25 PM
Hello Lui,

Please examine the following link:
Accessing cells and rows

Let us know if you have more questions.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
L
Top achievements
Rank 1
answered on 03 Mar 2009, 04:17 PM
hi

Ok, i have went through the suggestion. But my situation is different.

Basically i have 2 grid on the same page. One that display the categories and the other display the detail of the category based on the selection of the category on the grid.

For example. the radCatGrid would display the category name and some other information. So, when a user click on let say a category name called "Toys", the radProdGrid would display all the toys related to the category. I don't think i can use Hierarchy because of the both tables data is not related by PK or FK in my case.

My objective is to pass the selected value to a session when selected. How should i go about it . Thanks
0
Daniel
Telerik team
answered on 04 Mar 2009, 03:18 PM
Hello Lui,

As far as I understood you have related grids like in the following demo:
Related grids

I hope this example fits your scenario.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
L
Top achievements
Rank 1
answered on 05 Mar 2009, 01:44 PM
hi

Ok, I have read through the related grid. But how do i do it programetically meaning code behind. I want to have more control? Thanks
0
Accepted
Daniel
Telerik team
answered on 05 Mar 2009, 02:21 PM
Hello Lui,

The following links will help you create your RadGrid dynamically.

documentation:
Programmatic creation

online demos:
Programmatic creation on PageInit
Programmatic creation on PageLoad

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
L
Top achievements
Rank 1
answered on 05 Mar 2009, 03:57 PM
hi

Sorry, I have tried the related grid example but it seems not working for me. I believe the selectedValues must based on an ID field which is not what i want or have.

Ok, based on my code below i am able to access the cell value. But i want to access the cell value based on the row i have clicked.

I have a select button on every row in the grid and i want to pass the dataItem value to a session when i click the select button. How do I accomplish that? Thanks

 

Protected Sub RadGrid1_DataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

 

 

If TypeOf e.Item Is GridDataItem Then

 

 

Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)

 

Session(

"bs") = dataItem("BuyerSeller").Text.Substring(0, 3)

 

 

Session("PName") = dataItem("PName").Text

 

Session(

"PType") = dataItem("PType").Text

 

 

If Session("bs") = "Buy" Then

 

Session(

"label") = "List Of Sellers for "

 

 

Else

 

Session(

"label") = "List Of Buyers for "

 

 

End If

 

 

End If

 

 

End Sub

 

0
L
Top achievements
Rank 1
answered on 05 Mar 2009, 04:14 PM
ok. I got it working. Thanks
Tags
Grid
Asked by
L
Top achievements
Rank 1
Answers by
Daniel
Telerik team
L
Top achievements
Rank 1
Share this question
or