Hi ,
I am using a RadGrid and i have a RadCombo in one of the column. That combo has external call back.
When the radcombo box triggers the selected index changed event of server side. There in the code behind based on condition
I want to change the focus to either the same combo or next control in the grid. How ever as the page refreshes the i am loosing the focus. I want IsPostback to be "True" because i have some condition to check in serverside. And the focus should move to the next control in the grid.
Please tell me how i can achieve this?
Code in server side:
if condition()
{
((RadComboBox)currentEditItem["AmendmentNumber"].FindControl("ddlAmendmentNos")).Focus()
}
else
{
currentEditItem["AmendmentPurpose"].Focus();
((RadTextBox)currentEditItem["AmendmentPurpose"].FindControl("txtPurpose")).Focus();
}
RadCombo Settings:
<rad:GridTemplateColumn UniqueName="AmendmentNumber" DataField="Number" HeaderText="Bylaw #" ItemStyle-Width="10%"><ItemTemplate> <rad:RadComboBox Height="200px" ID="ddlAmendmentNos" MaxLength="10" runat="server" ToolTip="Enter Bylaw Number"AllowCustomText="true" MarkFirstMatch="false" ShowToggleImage="False" SkinsPath="~/RadControls/ComboBox/Skins"Skin="LIComboBoxSkin" ShowMoreResultsBox="true" EnableLoadOnDemand="True" ExternalCallBackPage="AmendmentNosDropDownBox.aspx"OnClientFocus="OnClientFocus" Text='<%# Eval("Number")%>' DataTextField="Number" OnSelectedIndexChanged="ddlAmendmentNos_SelectedIndexChanged"DataValueField="ID" AutoPostBack="true" ShowDropDownOnTextboxClick="false"></rad:RadComboBox></ItemTemplate></rad:GridTemplateColumn>
Regards
Siva Kumar KB
13 Answers, 1 is accepted
0
Hello siva,
Basically, you can use the selected index changed event handler for the combo, to get a reference to it, and then to its naming container, which would be the edit form. From there, you can access all the elements in the edit form, and set the focus to them accordingly.
I hope this suggestion get you started properly.
Greetings,
Yavor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Basically, you can use the selected index changed event handler for the combo, to get a reference to it, and then to its naming container, which would be the edit form. From there, you can access all the elements in the edit form, and set the focus to them accordingly.
I hope this suggestion get you started properly.
Greetings,
Yavor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Poornima S
Top achievements
Rank 1
answered on 30 Jul 2009, 08:45 AM
Thanks Yavor for the reply.
I tried implementing the suggestion provided by you. But it is not working for me.
I got the reference to the textbox to which i want to set the focus in the selected index changed event of the rad comb box as follows,
ControlToFocus = ((RadTextBox)currentEditItem["AmendmentPurpose"].FindControl("txtPurpose"))
and then to the naming container as,
ControlToFocus.NamingContainer.
In the PreRender event of the page, i tried to set the focus to the textbox as
ControlToFocus.NamingContainer.FindControl("txtPurpose").Focus();
Please help!!!
Thanks
Poornima
I tried implementing the suggestion provided by you. But it is not working for me.
I got the reference to the textbox to which i want to set the focus in the selected index changed event of the rad comb box as follows,
ControlToFocus = ((RadTextBox)currentEditItem["AmendmentPurpose"].FindControl("txtPurpose"))
and then to the naming container as,
ControlToFocus.NamingContainer.
In the PreRender event of the page, i tried to set the focus to the textbox as
ControlToFocus.NamingContainer.FindControl("txtPurpose").Focus();
Please help!!!
Thanks
Poornima
0
Hello Poornima S,
I attached a sample project with the desired functionality.
This is the part of the code where focus is being transferred to the next control:
I hope I managed to help you solve your problem. Please contact us if you need further assistance.
Sincerely yours,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I attached a sample project with the desired functionality.
This is the part of the code where focus is being transferred to the next control:
protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
RadComboBox comboBox = (RadComboBox)sender; |
GridEditableItem current = (GridEditableItem)comboBox.NamingContainer; |
current.FindControl("RadComboBox2").Focus(); |
} |
I hope I managed to help you solve your problem. Please contact us if you need further assistance.
Sincerely yours,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Stacy
Top achievements
Rank 1
answered on 04 Feb 2011, 03:46 PM
I have this code below...
On the SelectedIndexChanged method of the combo box, i am trying to set focus to the date control. I have tried using these four methods:
<
MasterTableView
DataKeyNames
=
"Key"
>
<
Columns
>
<
wasp:GridTemplateControl
UniqueName
=
"TemplateOrganizationUnitLevelId"
>
<
ItemTemplate
>
<
wasp:ComboBoxControl
ID
=
"OrganizationUnitLevelId"
AutoPostback
=
"True"
runat
=
"server"
ReadOnly='<%# ReadOnly %>'
meta:resourcekey="OrganizationUnitLevelId"
onselectedindexchanged="OrganizationUnitLevelId_SelectedIndexChanged"
ondatabinding="OrganizationUnitLevelId_DataBinding"
Value='<%# Bind("OrganizationUnitHierarchyId") %>'
LabelValue='<%# Bind("OrganizationUnitLevelId") %>'
>
</
wasp:ComboBoxControl
>
</
ItemTemplate
>
</
wasp:GridTemplateControl
>
<
wasp:GridTemplateControl
UniqueName
=
"Template"
>
<
ItemTemplate
>
<
wasp:DateControl
ID
=
"OrganizationUnitHierarchyStartDate"
Text
=
"Start Date"
runat
=
"server"
LabelValue='<%# Bind("OrganizationUnitLevelId") %>'
meta:resourcekey="OrganizationUnitHierarchyStartDate"
OnSelectedDateChanged="OrganizationUnitHierarchyStartDate_SelectedDateChanged"
Value='<%# Bind("OrganizationUnitHierarchyStartDate") %>' ReadOnly='<%# ReadOnly %>' />
</
ItemTemplate
>
</
wasp:GridTemplateControl
>
</
Columns
>
</
MasterTableView
>
1. ((ComboBoxControl)sender).BindingContainer.FindControl("OrganizationUnitHierarchyStartDate").Focus();
2. ((ComboBoxControl)sender).NamingContainer.FindControl("OrganizationUnitHierarchyStartDate").Focus();
3. Page.SetFocus(((ComboBoxControl)sender).BindingContainer.FindControl("OrganizationUnitHierarchyStartDate"));
4. ComboBoxControl comboBox = (ComboBoxControl)sender;
GridEditableItem current = (GridEditableItem)comboBox.NamingContainer;
current.FindControl("OrganizationUnitHierarchyStartDate").Focus();
The result is I always lose focus. This grid is a control that is part of another ascx. Any ideas?
0
Hello Stacy,
Have you ajaxified your pages?
In case you have, I recommend that you use the FocusControl method of the RadAjaxControl.
I hope this helps.
Best wishes,
Mira
the Telerik team
Have you ajaxified your pages?
In case you have, I recommend that you use the FocusControl method of the RadAjaxControl.
I hope this helps.
Best wishes,
Mira
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Stacy
Top achievements
Rank 1
answered on 07 Feb 2011, 01:52 PM
The main control(ascx) has ajax, this second control(ascx, which gets included in the first ascx) does not have ajax and since it's included in the first, it wont know about the RadAjaxManager.
0
Hello Stacy,
Please use the GetCurrent method of the RadAjaxManager in order to get the AJAX manager instance.
You can examine the RadAjax and WebUserControls help topic for additional information.
I hope this helps.
Regards,
Mira
the Telerik team
Please use the GetCurrent method of the RadAjaxManager in order to get the AJAX manager instance.
You can examine the RadAjax and WebUserControls help topic for additional information.
I hope this helps.
Regards,
Mira
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Stacy
Top achievements
Rank 1
answered on 09 Feb 2011, 02:21 PM
I have tried using this:
RadAjaxManager temp = RadAjaxManager.GetCurrent(Page);
temp.FocusControl(((ComboBoxControl)sender).BindingContainer.FindControl("OrganizationUnitHierarchyStartDate"));
But it does not focus on the control.
0
Hello Stacy,
Please use the following code in order to implement the desired functionality:
You can examine the Setting Focus demo for additional information.
Greetings,
Mira
the Telerik team
Please use the following code in order to implement the desired functionality:
void
combo_SelectedIndexChanged(
object
o, RadComboBoxSelectedIndexChangedEventArgs e)
{
RadComboBox comboBox = (RadComboBox)o;
GridEditableItem current = (GridEditableItem)comboBox.NamingContainer;
RadAjaxManager.GetCurrent(Page).FocusControl(current.FindControl(
"RadComboBox2"
).ClientID +
"_Input"
);
}
You can examine the Setting Focus demo for additional information.
Greetings,
Mira
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Stacy
Top achievements
Rank 1
answered on 14 Feb 2011, 02:16 PM
That has no effect either.
0
Hello Stacy,
I tried to replicate the issue which you described, but to no avail.
Attached to this message, you will find the code which I used for testing.
Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.
Kind regards,
Mira
the Telerik team
I tried to replicate the issue which you described, but to no avail.
Attached to this message, you will find the code which I used for testing.
Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.
Kind regards,
Mira
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Stacy
Top achievements
Rank 1
answered on 15 Feb 2011, 02:21 PM
As i've said throughout my postings, i'm using a control within a control. I do not see this in the code you have attached.
I have my ascx and within it, i reference another ascx (ie. <uc2:OrganizationUnitControl id="blah"... />
When the selectedIndexChanged event fires for the comboboxes in "OrganizationUnitControl", i cannot get them to keep focus or move focus to the next input item.
I have my ascx and within it, i reference another ascx (ie. <uc2:OrganizationUnitControl id="blah"... />
When the selectedIndexChanged event fires for the comboboxes in "OrganizationUnitControl", i cannot get them to keep focus or move focus to the next input item.
0
Hello Stacy,
Are the both comboxes in the OrganizationUnitControl control?
If yes, please use the following code:
If they are not, please provide more information on the structure of your page.
I hope this helps.
Greetings,
Mira
the Telerik team
Are the both comboxes in the OrganizationUnitControl control?
If yes, please use the following code:
void
combo1_SelectedIndexChanged(
object
o, RadComboBoxSelectedIndexChangedEventArgs e)
{
RadComboBox comboBox = (RadComboBox)o;
GridEditableItem current = (GridEditableItem)comboBox.NamingContainer;
RadAjaxManager.GetCurrent(Page).FocusControl(current.FindControl(
"RadComboBox2"
).ClientID +
"_Input"
);
}
I hope this helps.
Greetings,
Mira
the Telerik team