471,592 Members | 1,149 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,592 software developers and data experts.

to set focus to a control which is in a panel in asp.net 2.0

11
Hi

I'm new to this asp.net environment .. i have aproblem like i have a asp page with multiple panel ... the page's default focus is already set to a text box in a panel... now when i click a button in say panel 1 . a model popup panel gets loaded ... now i have to set the focus to the control in that model pop up panel..
i'm not sure how to do it... can anyonehelp me in this regard .. thanks in advance
May 11 '07 #1
4 9766
swifty
1
Hi,
I'm also new to ASP.NET 2.0 and had a simular problem.
I had a focus on my desired textbox but since I moved that textbox inside a panel + and moved tat panel in an AJAX UpdatePanel I loose the focus.
When the page loads you can see for 0,5 seconds the cursor in the textbox and than it goes simply away.
First I thought it had to do with the complicated loading mechanisme of AJAX but when I moved the textbox out of the panels there was no problem.
Can Some help me?
May 23 '07 #2
bujjai
8
Hi

I'm new to this asp.net environment .. i have aproblem like i have a asp page with multiple panel ... the page's default focus is already set to a text box in a panel... now when i click a button in say panel 1 . a model popup panel gets loaded ... now i have to set the focus to the control in that model pop up panel..
i'm not sure how to do it... can anyonehelp me in this regard .. thanks in advance
if it is textbox putlike this ....

txt_box1.Focus(); particular panel ok...
i think it works based on my understand.. if not send me i will do and try
May 23 '07 #3
try this on page load

onload="javascript:document.FormName.txtBoxId.focu s();"
May 24 '07 #4
Setting the focus on page/form load is not a solution.

Use the proxylink for the ModalPopupextender and use another link button to show/hide the panel.

<asp:LinkButton ID="AddUserLink" runat="server" OnClick="AddUserLink_Click">[Search Active Directory]</asp:LinkButton>
<asp:LinkButton ID="AddUserLinkProxy" runat="server"></asp:LinkButton>
<%--<asp:LinkButton ID="PreviewLinkButton" runat="server" CausesValidation="true" OnClientClick="PopUp('CodeSetMaintenance.aspx');" >LinkButton</asp:LinkButton>--%>
<asp:LinkButton ID="PreviewLinkButton" runat="server" CausesValidation="true" OnClientClick="PopUp('CodeSetMaintenance.aspx');" ></asp:LinkButton>
<ajax:ModalPopupExtender runat="server" ID="FindUserPopup" BackgroundCssClass="modalBackground" TargetControlID="AddUserLinkProxy" PopupControlID="FindUserPanel" CancelControlID="FindUserCloseButton"></ajax:ModalPopupExtender>


<asp:Panel runat="server" ID="FindUserPanel" CssClass="ModalWindow" DefaultButton="FindUserButton" >
<table>
<tr>
<td class="FieldCaption">Name:</td>
<td class="Spacer">&nbsp;</td>
<td class="FieldValue">
<asp:TextBox runat="server" ID="FindUserNameText"></asp:TextBox>
<asp:Button runat="server" ID="FindUserButton" Text="Find" OnClick="FindUserButton_OnClick" />

</td>
</tr>

</table>
</asp:Panel>

in the code behind

protected void AddUserLink_Click(object sender, EventArgs e)
{
FindUserNameText.Focus();
FindUserPopup.Show();

}

post if you anyone of you found any simple solution.
Sep 5 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by codymanix | last post: by
2 posts views Thread by IMRAN SAROIA | last post: by
1 post views Thread by mongphong28 | last post: by
reply views Thread by =?Utf-8?B?R2FyeSBX?= | last post: by
8 posts views Thread by Mel | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.