[RESOLVED] Set focus on ModalPopup and Perform Search
Hi, I'm working on web and I don't know how to do it.
I open the ModalPopup by button. But the focus continues in the button and y want that the focus goes to textbox inside my ModalPopup.
How can I do?
Thanks in advance and sorry for my bad English. ;)
Re: Set fous on ModalPopup
Hey,
I take it you mean you are using the AJAX Control Toolkit, is that right?
Can you post the code/markup that you are currently using?
Gary
Re: Set fous on ModalPopup
There is very simply:
Popup DIv elemenet called 'modalAg' and this:
<asp:button id="Busca" runat="server" Width="125px" Text="Buscar"
CausesValidation="False" TabIndex="15"></asp:button>
<cc1:ModalPopupExtender ID="Busca e_ModalPopupExtender" runat="server"
DynamicServicePath="" Enabled="True" TargetControlID="Busca" CancelControlID="Cancelar"
PopupControlID="modalAg">
</cc1:ModalPopupExtender>
Re: Set fous on ModalPopup
Re: Set fous on ModalPopup
Well I do it by Js.
But, I have 3 buttons on the page, and I need that when pulse Enter don't show the popup. I want that perform the form. How can I do it?
Thanks!
Re: Set fous on ModalPopup
Hey,
I am really not sure that I follow what you are asking? Can you elaborate? Perhaps with the use of screen shots?
Gary
Re: Set fous on ModalPopup
Well I get the answer by my self again.
I add an event for all textbox of page: onkeypress="sendform(event)" and check if its Enter Key. If its send the form :D
the js for if someone need:
function sendform(e){
key = (document.all) ? e.keyCode : e.which;
if (key==13) {
$('#ctl00_ContentPlaceHolder1_Search').click();
}
}
Thanks gep13 for your replys ;)
Re: [RESOLVED] Set focus on ModalPopup and Perform Search
If you were trying to set focus to the textbox, you could send some javascript from the codebehind to the page.
string jsToSend = "$('" + SearchTextBox.ClientID + "').focus();";
So that you're not hardcoding the ClientID in your javascript.