473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 9937
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

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

Similar topics

2
by: codymanix | last post by:
I have a panel which is located in a AutoScroll-enabled panel. The problem is when I click in the panel, the contining panel automatically scrolls to position (0,0). How can I get around this...
2
by: IMRAN SAROIA | last post by:
Hi! Please advise how to set focus to any control on Web and Windows Forms. Regards Imran
3
by: Dave | last post by:
We are developing a web page that shows large graphics. To provide more screen space for the graphics, we allow the user to popup a window that places itself over the top part of the browser. This...
1
by: Workgroups | last post by:
Not having much luck tracking this down... I'm working with a form, Form1, which contains a panel called pnlParent. Both Form1 and pnlParent have AutoScroll = False. pnlParent contains a panel...
1
by: mongphong28 | last post by:
Hi, I'm using a treeview as a menu, and when the user clicks on a node I want the focus to set to a control (ie textbox) in a panel to the right. The problem I'm having is the focus will not...
0
by: =?Utf-8?B?R2FyeSBX?= | last post by:
Here is my problem. I have a datagrid that when you click on a row, it goes into edit mode and depending on where I clicked it the focus is on that control using Control.Focus(). I also have code...
4
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I...
8
by: Mel | last post by:
I have several text boxes and drop-down lists in an AJAX Update Panel. All user inputs have the Postback property set to True. After I type something in the first input entry and press the "Tab"...
3
by: Rich P | last post by:
One thing I have noticed with .Net is that various controls can have the same tab index and the app still compiles. I would set the tab index of your splitter to some large number (larger than a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.