2

モーダル ダイアログに jquery を使用しています。あるページからモデル ダイアログを開き、追加のクエリ文字列をモーダル ダイアログ ページに送信したいと考えています。このようなもの:

 <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" > 

この例は機能しません。誰かが解決策を知っていますか?

4

2 に答える 2

4

ヘルギの答えに加えて。
jQueryを使用してテキストボックスの値を取得したい場合(他のセレクターを使用する必要がある場合はid)、次を使用できます。

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

編集
ああ、モーダルを使用していることに気付きました。次に、ページが iFrame で開かれ、次を使用して iFrame 内から値を取得できます。

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

また、iFrame リクエストでサーバーに送信する必要がある場合は、クリック時にリンクの href 属性を編集してみてください。

$('#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
});
于 2009-04-10T09:47:09.177 に答える
1

開いたときにモーダル ダイアログでこれを試してください (これはクライアント側の JavaScript です)。

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

次に、Javascript を使用して、たとえば JQuery を使用して、追加情報をダイアログの正しい場所に挿入します。

于 2009-04-10T09:39:07.027 に答える