2

I'm using jquery for modal dialogs. I want to open model dialog from one page and to send some additional query string to modal dialog page. something like this:

 <asp:HyperLink ID="hypClientSearch" runat="server" NavigateUrl="~/SomePage.aspx?KeepThis=true&additionalQS='<%= txtBox.Text %>'&TB_iframe=true&height=650&width=800&modal=true" CssClass="thickbox" > 

This example doesn't work. Does anyone know the solution?

2 Answers 2

4

In addition to Helgi's answer.
If you want to get the value of the textbox using jQuery (for when you need to use other selectors then the id) you can use:

var textBoxValue = $(textBoxSelector, window.opener.document).val();

Edit
Oh I just noticed that your using modal. Then the page is opened in an iFrame, you can get the value from within the iFrame using:

var textBoxValue = $(textBoxSelector, window.parent.document).val();

Also if you need to send it to the server at the iFrame request try editing the href attribite of the link on click:

$('#hypClientSearch').click( function() {
 var textBoxContent = $(textBoxSelector).val();
 $(this).attr('href', 'somepage.aspx?textbox='+textBoxContent+'&otherVarsForModal=foo');
 //we let the event bubble for the modal plugin, so ne returning false here
});
Sign up to request clarification or add additional context in comments.

Comments

1

Try this in the modal dialog when it opens (this is client side javascript):

var textBoxValue = window.opener.document.getElementById("txtBoxId").value;

You then use Javascript to insert the additional info into the correct place in the dialog, for example using JQuery.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.