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

2 posts, 0 answers
  1. amit
    amit avatar
    2 posts
    Member since:
    Feb 2016

    Posted 28 Feb Link to this post

    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

  2. Vessy
    Admin
    Vessy avatar
    1382 posts

    Posted 02 Mar Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top