How to get focused control ID in C# web application

2 posts, 0 answers
  1. Raj
    Raj avatar
    33 posts
    Member since:
    Jan 2012

    Posted 28 Aug 2015 Link to this post

    hi friends,

    i have editable radgrid, where all the fileds is in open state. it contains textbox and label.

    user can enter value in any textbox in the grid.

    mean while, i am refreshing the grid using timer at regular interval.

    my issue is, after refresh, the cursor is disappears from the control.

     

    i need to set focus to the same control,where the cursor before postba​ck.

    it is possible to take focused control id in server side using C# web application.

    it possible, give me some ideas.

     

    Thanks in advance

    ASRK.....

  2. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 02 Sep 2015 Link to this post

    Hello Raj,

    You can implement AJAX in this scenario:
    http://demos.telerik.com/aspnet-ajax/ajaxmanager/application-scenarios/ajaxify-timer/defaultcs.aspx

    And make avail of the OnRequestStart event handler:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/ajax/client-side-programming/events/onrequeststart

    Within the event you can keep the id of the focused input using a HiddenField:
    https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hiddenfield%28v=vs.90%29.aspx

    And using OnResponseEnd event handler you can set the focus back after the AJAX request initiated by the Timer is complete:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/ajax/client-side-programming/events/onresponseend

    Hope this helps. I can also prepare a sample RadGrid web site if you prefer.

    Regards,
    Eyup
    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