On my MasterPage I've a ScriptManager and one ContentPlaceHolder, My Webpage contains three UserControls and each UserControl uses UpdatePanel... now i want to call JavaScript Focus() Method Using ScriptManagerProxy... um using the following Code...
but I couldn't find if it is supported by C#.Net 2.0 and one more thing i need to call JavaScript focus() in my UserControl and i've taken ScriptManager on my MasterPage... and that's y i need to use ScriptManagerProxy....[:(]
krishnaprasa...
Participant
858 Points
171 Posts
Re: DropDownList Focus is Lost!!!
Mar 01, 2008 10:01 AM|LINK
The simple way I think is in the first Dropdown list' selected event write the following code(two DropdownList DDL1, DDL2)
protected void DDL1_SelectedIndexChanged(object sender,EventArgs e)
{
DDL2.Attributes.Add("onload","javascript:this.focus();");
}
MCTS
itsnasir
Member
46 Points
49 Posts
Re: DropDownList Focus is Lost!!!
Mar 04, 2008 05:55 AM|LINK
Hi vasanth.kumar.d
Sorry for the delay...
On my MasterPage I've a ScriptManager and one ContentPlaceHolder, My Webpage contains three UserControls and each UserControl uses UpdatePanel... now i want to call JavaScript Focus() Method Using ScriptManagerProxy... um using the following Code...
ScriptManagerProxy1.Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"ReturnScript","document.getElementById('"+cmbSettlementDate.ClientID +"').focus();",true);vasanth.kuma...
Contributor
5324 Points
1041 Posts
Re: DropDownList Focus is Lost!!!
Mar 04, 2008 06:16 AM|LINK
Hi,
try the below one...
ScriptManager.RegisterStartupScript(this, this.GetType(),
"ReturnScript", "document.getElementById('"+cmbSettlementDate.ClientID +"').focus();", true);Software Engineer.
itsnasir
Member
46 Points
49 Posts
Re: DropDownList Focus is Lost!!!
Mar 04, 2008 06:29 AM|LINK
Thank you sir for ur Quick Reply
but I couldn't find if it is supported by C#.Net 2.0 and one more thing i need to call JavaScript focus() in my UserControl and i've taken ScriptManager on my MasterPage... and that's y i need to use ScriptManagerProxy....[:(]
plz plz plz help me
Thanks
Nasir Ibrahim
vasanth.kuma...
Contributor
5324 Points
1041 Posts
Re: DropDownList Focus is Lost!!!
Mar 04, 2008 07:29 AM|LINK
Hi,
I will list my test environment for this..
1. I have master page in which Script managner and update panel is present.
2. User controls with 2 dropdowns... in which I had written the above code in onselectedindex changed event of first dropdowm..
3. One content page for master... and user control added to it..
please let me know whether both of us using the same flow.....
Software Engineer.
itsnasir
Member
46 Points
49 Posts
Re: DropDownList Focus is Lost!!!
Mar 04, 2008 08:54 AM|LINK
Hi
1- I've a MasterPage in which only ScriptManager is present and NOT an UpdatePanel...
2- UserControls in which ScriptManagerProxy and UpdatePanel is Present and in this UpdatePanel all the remaining controls are present.
3- On My DropDownList AutoPostBack is true, and 2nd DropDownList is filled using 1st DropDownList Selected value on run time...
4- One ContentPlaceHolder in Master Page.
Thanks
Nasir Ibrahim
vasanth.kuma...
Contributor
5324 Points
1041 Posts
Re: DropDownList Focus is Lost!!!
Mar 04, 2008 10:47 AM|LINK
Hi Nasir,
sorry for the delay...
I hope this will be the last post for this problem...
try the below one....
ScriptManager.RegisterStartupScript(
Me.Page, Me.Page.GetType(), "foc", "document.getElementById('" + DropDownList2.ClientID + "').focus();", True)Software Engineer.
itsnasir
Member
46 Points
49 Posts
Re: DropDownList Focus is Lost!!!
Mar 04, 2008 12:31 PM|LINK
Hi
Thank you sooooo much Mr. Vasanthakumar ...
Ya this is the last Post on this Topic [:D] ...
U really give me toooo much time and um really very much thankful....
GOD Bless you and grant u with more Knowledge... Take Care
Thanks again
Nasir Ibrahim
vasanth.kuma...
Contributor
5324 Points
1041 Posts
Re: DropDownList Focus is Lost!!!
Mar 05, 2008 03:39 AM|LINK
Hi Nasir,
Thanks ya..
Software Engineer.
SubaAberdeen
Member
24 Points
21 Posts
Re: DropDownList Focus is Lost!!!
May 02, 2012 01:45 PM|LINK
Hi Vasath.
Thanks for this code. It is working fine for me