Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Accessing controls in radgrid EditTemplate edit mode

Not answered Accessing controls in radgrid EditTemplate edit mode

Feed from this thread
  • Amit avatar

    Posted on Feb 22, 2012 (permalink)

    Is it possible to access other controls in EditTemplate when in edit mode beside the drop down list, because drop down list causes post back we can handle the event and access the other controls like you mentioned above. What I want to do is when user click the edit button on row item, I want to access a textbox which is in the EditTemplate and enable a required field validator on this text box. The field is required or not required depends on the drop down list in the form but since user is in edit mode he is not changing item on the drop down box.

    If there a way please also let me know the event in which I should access them.

    Please help me, I have spend so much time and still haven't found a solution yet.

    Thanks in advance,
    Amit

    Reply

  • Marianne Seggerman Master avatar

    Posted on Feb 23, 2012 (permalink)

    for starters, you'll either need to look at the ItemDataBound (if you need to look at the actual content of the control) event or the ItemCreated event (for the control without any data)

    in the ItemDataBound event, cast the e.Item to ??? not sure what the object is, it depends on a bunch of criteria
    then isolate the TableCell of the column you are interested in, then within that column tease out the control you want

    hope that helps

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Posted on Feb 23, 2012 (permalink)

    Hello,

    Try the following code.
    C#:
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {  
      GridEditableItem item = (GridEditableItem)e.Item;
      TextBox textbox = (TextBox)item.FindControl("TextBox1");
     }
    }

    Thanks,
    Princy.

    Reply

  • Amit avatar

    Posted on Feb 24, 2012 (permalink)

    That helped me. That's exactly what I want. Thanks for the quick reply.

    Amit

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Accessing controls in radgrid EditTemplate edit mode
Related resources for "Accessing controls in radgrid EditTemplate edit mode"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]