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

[Solved] Get Row Index when RadTextBox column's generic button is clicked

2 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan Yeow
Top achievements
Rank 1
Ryan Yeow asked on 06 Nov 2009, 09:09 AM
Hi

I have a RadGrid with a template column. Inside the template column there is a RadTextBox with ShowButton=true.

I need to get the index of the row when the generic button is clicked. Any idea?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Nov 2009, 12:46 PM
Hello Ryan,

Here's an example to invoke a server side event handler on clickin the button of a RadTextBox:
aspx:
<EditItemTemplate> 
    <telerik:RadTextBox ID="RadTextBox1" runat="server" ShowButton="true"
        <ClientEvents OnButtonClick="ButtonClick" /> 
    </telerik:RadTextBox> 
</EditItemTemplate> 

js:
function ButtonClick(sender,args) 
    {   
        var editIndex= $find("RadGrid1")._editIndexes ; 
        __doPostBack("<%= RadGrid1.UniqueID %>",editIndex);           
           
    } 

c#:
protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument) 
    { 
        if (eventArgument != ""
        { 
            GridDataItem editItem = (GridDataItem)RadGrid1.MasterTableView.Items[Convert.ToInt32(eventArgument)]; 
        } 
            base.RaisePostBackEvent(sourceControl, eventArgument); 
    } 

Thanks
Princy.
0
Ryan Yeow
Top achievements
Rank 1
answered on 09 Nov 2009, 08:04 AM
Hi

Thanks for the help :)



However, this line doesn't give the rowclicked. It contains the array of the total number of rows in the grid:
var editIndex= $find("RadGrid1")._editIndexes ; 
...
Value of editIndex = {"0", "1", "2", "3", ....}


Can you help me? I need the rowclicked and the column's unique id of the button clicked...





Tags
Grid
Asked by
Ryan Yeow
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ryan Yeow
Top achievements
Rank 1
Share this question
or