get value of each row in textbox column

3 posts, 1 answers
  1. shervinrv
    shervinrv avatar
    10 posts
    Member since:
    May 2007

    Posted 23 Sep 2014 Link to this post

    Hello.
    Excuse me if my english is not well.
    i have a textbox column in radgrid.
    <telerik:GridTemplateColumn  SortExpression="score" HeaderText="score" HeaderButtonType="TextButton"
                        DataField="score" UniqueName="score" ReadOnly="true">
                           <ItemTemplate>
                               <telerik:RadTextBox runat="server">
     
                               </telerik:RadTextBox>
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>

    and a button . 
    how can i get value of each textbox by clicking button ?
    for example row with id=1 >> textbox=15
    actually i'm looking for bulk data submit.in edit mode i can submit values row by row and it's time consuming.
    if there is any other option please tell me.
    thank you
  2. Answer
    Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 23 Sep 2014 in reply to shervinrv Link to this post

    Hi,

    Please write below code in button click event.
    foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
    {
        RadTextBox txtscore = item.FindControl("txtscore") as RadTextBox;
        string id = item.GetDataKeyValue("id").ToString();
        // Access id and textbox value here
    }

    Also add datakey in mastertablerview tag and add ID in textbox

    <MasterTableView DataKeyNames="id">
    .........
    .........
     
    <telerik:GridTemplateColumn  SortExpression="score" HeaderText="score" HeaderButtonType="TextButton"
            DataField="score" UniqueName="score" ReadOnly="true">
        <ItemTemplate>
                <telerik:RadTextBox ID="txtscore" runat="server">
     
                </telerik:RadTextBox>
        </ItemTemplate>
    </telerik:GridTemplateColumn>

    Let me know if any concern.

    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. shervinrv
    shervinrv avatar
    10 posts
    Member since:
    May 2007

    Posted 23 Sep 2014 Link to this post

    Thank you Jayesh Goyani.
    It works
Back to Top