Hi,
GridView control that is released by Microsoft with VS2005, I can easily get the value of any cell with in the selected row (Server side)
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Dim ItemValue As String
ItemValue = GridView1.SelectedRow.Cells(1).Text
End Sub
Can I do it using the rad grid control in simlier way.
Please Help me on this...
Thanks
6 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 19 May 2008, 06:38 AM
Hi Omar,
Try the following code snippet to achieve the desired scenario.
ASPX:
CS:
Thanks
Princy.
Try the following code snippet to achieve the desired scenario.
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged" > |
CS:
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e) |
{ |
foreach (GridItem item in RadGrid1.MasterTableView.Items) |
{ |
if (item.Selected) |
{ |
string strtxt = item.Cells[2].Text.ToString(); |
} |
} |
} |
Thanks
Princy.
0
Accepted
Hi guys,
You can similar approach with RadGrid SelectedIndexChanged. Here is an example:
Dim ItemValue As String
If you define DataKeyNames you can use directly RadGrid1.SelectedValue.
Best wishes,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can similar approach with RadGrid SelectedIndexChanged. Here is an example:
Dim ItemValue As String
ItemValue = RadGrid1.SelectedItems[0]["YourColumnUniqueName"].Text
If you define DataKeyNames you can use directly RadGrid1.SelectedValue.
Best wishes,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Matthew
Top achievements
Rank 1
answered on 12 Jun 2008, 06:12 PM
I'm missing something. I've tried both of these approaches and either a) selectedItems.count is always 0 or b) selectedIndexChanged is never getting fired. Any ideas?
0

Shinu
Top achievements
Rank 2
answered on 13 Jun 2008, 05:23 AM
Hi Mathew,
Have you set the SelectedIndexChanged event handler in the aspx?
ASPX:
Thanks
Shinu.
Have you set the SelectedIndexChanged event handler in the aspx?
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged" > |
Thanks
Shinu.
0

Matthew
Top achievements
Rank 1
answered on 13 Jun 2008, 05:44 PM
Shinu:
Yes, I had that value set. A coworker and I tried a lot of things before we finally found something that worked. We were trying to get some events to fire without resorting to buttons, links, or checkboxes; we finally found a reference to the AutoPostbackOnRowClick parameter which has the grid now firing the needed events.
Thanks.
Matt
Yes, I had that value set. A coworker and I tried a lot of things before we finally found something that worked. We were trying to get some events to fire without resorting to buttons, links, or checkboxes; we finally found a reference to the AutoPostbackOnRowClick parameter which has the grid now firing the needed events.
Thanks.
Matt
0

Benito
Top achievements
Rank 1
answered on 13 Apr 2011, 10:29 PM
Try this: with asp.net (vb script)
cells(2) = column number of your grid.
Protected
Sub
Radgrid1_SelectedIndexChanged(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Radgrid1.SelectedIndexChanged
label1.text = Radgrid1.SelectedItems(0).Cells(2).Text
End
Sub
cells(2) = column number of your grid.