1

ページに必要なすべてのコードがあり、response.redirect必要な情報を他のページに渡します。しかし、ページをリダイレクトするのではなく、ページにポップアップを作成したくありません。ポップアップのコードもありますが、情報を渡すことができません。

これはポップアップのコードであり、情報を渡していません:

<asp:LinkButton ID="lb_viewstudenttimetable" runat="server" OnClick="lb_viewstudenttimetable_Click" 
     OnClientClick="window.open('Timetable_User.aspx','Timetable','width=640,height=360,scrollbars=yes');">

OnClickこれは、他のページに情報を渡すボタンのコードです

protected void lb_viewstudenttimetable_Click(object sender, EventArgs e)
{
    GridViewRow row = gv_classlist.SelectedRow;
    Response.Redirect("Timetable_User.aspx?UserID=" + row.Cells[1].Text + "");
    //my attempt of trying to pass the following to the popup        
    //Response.Write("window.open('Timetable_User.aspx?UserID="+row.Cells[1].Text+"','Timetable','width=640,height=360,scrollbars=yes');");
}

だから私はOnClientClickそれが何をするために使いたいOnClickです。

4

3 に答える 3

0
    GridViewRow row = gv_classlist.SelectedRow;
    lbl_timetableuserid.Text = row.Cells[1].Text;


    ScriptManager.RegisterStartupScript(this, typeof(string), "New_Window", "window.open('Timetable_User.aspx?UserID=" + row.Cells[1].Text + "', null, 'height=360,width=640,status=yes,toolbar=yes,menubar=yes,location=no' );", true);
于 2014-05-15T01:35:34.287 に答える
0

クエリ文字列を渡すだけです:

<asp:LinkButton ID="lb_viewstudenttimetable" runat="server" 
    OnClick="lb_viewstudenttimetable_Click" 
    OnClientClick="window.open('Timetable_User.aspx?UserID=x', 'Timetable', 'width=640,height=360,scrollbars=yes');">

問題は、「x」がサーバーから送信されたときに、「x」をクエリ文字列に取得する方法です。必要なことは、GridView の Databinding イベントで、OnClientClick で使用される JavaScript 文字列を作成してから設定することです。そうすれば、各グリッド行の LinkBut​​ton は、クリックされたときにすでに準備されています。

于 2014-05-09T18:46:15.087 に答える
0

ポップアップまたは新しいブラウザー タブが必要ですか? ポップアップが必要な場合は、通常、このような iframe を使用します。

<a rel="#popupinit" href="#" uniqenum='<%= serversideUniquenum %>'>Open popup</a>

<div style="background-color: white; top: 30px; text-align:center ; width:100%" id="ShowOrderGrid" >
   <iframe id="iframeid" src='' style="width: 500px; text-align:center ; height: 650px;"></iframe>
</div>

<script>
    $(function () {
        $("a[rel='#popupinit]").click(function () {
            var uniquenum = $(this).attr("uniquenum");
            $('#iframeid').attr('src', '/somepath/somepath/somepage.aspx?uniquenum=' + uniquenum);
        });
</script>
于 2014-05-09T19:22:01.730 に答える