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

Set Focus to GridBoundColumn in Edit Mode, when EditMode Property = PopUp

3 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carlos Contreras
Top achievements
Rank 1
Carlos Contreras asked on 20 Jul 2010, 08:28 PM

 Hi Everybody!

 I want to set focus to the first GridBoundColumn while a Inserting/Editing process. Searching for a while, I found this Topic, and It helped me a lot. In that topic there are 2 options to achieve what I want. The second option ddn't work in my case, and I suspect that is due to my RadGrid is inside a RadAjaxPanel. But I guess I can solve that if I use the RadScriptManager's method "SetFocus()".

Thus far, I have been using the Topic's first option without a problem, until I tried to do the same thing with the "PopUp" EditMode property value, and I'm getting the following JS message error:

Message: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
Line: 50781009
Char: 1
Code: 0

So, I'm wondering if it's possible to do the same thing illustrated on the Topic, but in the PopUp version of the Edit Mode?


Thanks!

3 Answers, 1 is accepted

Sort by
0
Carlos Contreras
Top achievements
Rank 1
answered on 21 Jul 2010, 11:47 PM
Anybody? Please!
0
Accepted
Tsvetoslav
Telerik team
answered on 23 Jul 2010, 07:36 AM
Hi Carlos,

Attached is a small sample. Hope it helps.

Regards,
Tsvetoslav
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Carlos Contreras
Top achievements
Rank 1
answered on 23 Jul 2010, 05:00 PM

Hi Tsvetoslav!

Thanks a lot for your reply and for your sample, which works fine by the way!

In addition to your solution, I found a simpler way to solve the problem (following your sample), and it worked for me!

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
   if (e.Item.IsInEditMode && e.Item is GridEditableItem)
   {
      txtBoxID = ((GridEditableItem)e.Item)["ProductName"].Controls[0].ClientID;
  
      ScriptManager sm = ScriptManager.GetCurrent(this.Page);
      sm.SetFocus(txtBoxID);
   }
}


Thank you VERY MUCH!
Tags
Grid
Asked by
Carlos Contreras
Top achievements
Rank 1
Answers by
Carlos Contreras
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or