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

[Solved] Getting value after selecting the SELECT command

2 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Malini
Top achievements
Rank 1
Malini asked on 24 Sep 2009, 03:25 AM
Hi,

We , few developers in my company evaluating the the RAD Controls for AJAX .net. I would like to know how to get the grid column value of a selected row.This is after the user select a row using the SELECT command.


Thanks

Malini

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Sep 2009, 04:36 AM
Hi Malini,

You can add GridButtonColumn columns to a grid to handle the selection and de-selection of grid rows. Here is the code for getting the selected row values in ItemCommand event.

aspx:
 
 . . . 
<Columns> 
    <telerik:GridButtonColumn CommandName="Select" Text="Select"
    </telerik:GridButtonColumn>    
    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID" 
        UniqueName="CustomerID"
    </telerik:GridBoundColumn> 
     . . . 
</Columns> 
 . . . 

cs:
 
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    if (e.CommandName == RadGrid.SelectCommandName) 
    { 
        string str = (e.Item as GridDataItem)["CustomerID"].Text; 
        Response.Write(str); 
    } 

Note: In addition, you can handle the SelectedIndexChanged server event of the grid to detect when a row's selection changes perform additional operations if needed.

-Shinu.
0
Malini
Top achievements
Rank 1
answered on 24 Sep 2009, 04:55 AM
Thanks Shinu for the fast reply.

If you dont mind, could you mindly provide me the vb.net code since i am using the vb.net code.
Sorry for troubling you.

Thanks

Malini
Tags
Grid
Asked by
Malini
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Malini
Top achievements
Rank 1
Share this question
or