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

fetch the row index and row items on click of button.

1 Answer 877 Views
Button
This is a migrated thread and some comments may be shown as answers.
amit
Top achievements
Rank 1
amit asked on 29 Feb 2016, 05:55 AM

Hi,

Need urgent help.

I am working on radgrid.

<telerik:GridBoundColumn SortExpression="BPMTempCheck" HeaderText="BPMTempCheck" AllowSorting="false"
                            HeaderButtonType="TextButton" DataField="BPMTempCheck" UniqueName="BPMTempCheck"
                            CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="75px" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ActionType" HeaderText="ActionType" AllowSorting="false"
                            HeaderButtonType="TextButton" DataField="ActionType" UniqueName="ActionType"
                            CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="75px" Display="false">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Shop Code" UniqueName="ShopCode">
                            <ItemTemplate>
                                <asp:TextBox ID="txtShopCode" runat="server"></asp:TextBox>                                                                                                
                            </ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Reporting Unit" UniqueName="ReportingUnit">
                            <ItemTemplate>
                                <asp:TextBox ID="txtReportingUnit" runat="server"></asp:TextBox>
                            </ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn>
                            <ItemTemplate>
                                <asp:Button ID="btnUploadGRS" runat="server" Text="Upload to GRAPE" OnClick="btnUploadGRS_Click" />
                            </ItemTemplate>
</telerik:GridTemplateColumn>

 

i want to fetch the row index and the other columns details on onClick event of the button "btnUploadGRS_Click". I want to fetch the details of the row in which button is clicked.

How can i get the details in the code behind file.

 

Thanks

Amit

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 02 Mar 2016, 05:19 PM
Hi Amit,

You can get access to the naming container of the button (the GridDataItem) in a similar way:
protected void btnUploadGRS_Click(object sender, EventArgs e)
{
    System.Web.UI.WebControls.Button btn = (System.Web.UI.WebControls.Button)sender;
    GridDataItem item = (GridDataItem)btn.NamingContainer;
 
    //your code here, e.g.:
    TextBox tb = (TextBox)item.FindControl("txtReportingUnit");
}

Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Button
Asked by
amit
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or