我想使用彈出式窗口來更新2個字段,無論是手動輸入還是從下拉列表中填充。 所以我需要一個提交按鈕彈出。 我正在試驗「我如何」視頻中的代碼。 在視頻中,他們顯示了一個從單選按鈕列表中彈出的更新字段。 我決定改變它,以便不用關閉單選按鈕SelectedIndexChanged事件中的彈出窗口,而是將其刪除並將代碼放在按鈕提交事件中。 但是,我得到的消息; Microsoft JScript運行時錯誤:'this._postBackSettings.async'爲空或不是對象 代碼是;Ajax彈出式擴展程序 - 爲什麼它不適用於提交按鈕
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function UpdateField(text)
{
var test = text + ' - SEND A MEETING REQUEST!';
$get("MyTextBox").value = test;
// $get("lblTest").value = test;
//
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel runat="server" ID="updTest">
<ContentTemplate>
<br />
ToDo:
<asp:TextBox ID="MyTextBox" runat="server" Width="538px"></asp:TextBox>
<br />
<asp:Panel ID="Panel1" runat="server" CssClass="popupControl" DefaultButton="btnTest">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="146px">
<asp:ListItem Text="Scott Guthrie"></asp:ListItem>
<asp:ListItem Text="Simon Muzio"></asp:ListItem>
<asp:ListItem Text="Brian Goldfarb"></asp:ListItem>
<asp:ListItem Text="Joe Stagner"></asp:ListItem>
<asp:ListItem Text="Shawn Nandi"></asp:ListItem>
</asp:RadioButtonList>
<div style="padding:10px;">
<asp:Button runat="server" ID="btnTest" Text="Submit" onclick="btnTest_Click" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" CommitProperty="value"
CommitScript="UpdateField(e.value);" PopupControlID="Panel1"
Position="Bottom" TargetControlID="MyTextBox">
</ajaxToolkit:PopupControlExtender>
</asp:Panel>
<div style="padding:20px;"><asp:Label runat="server" ID="lblTest" Text="Test"/> </div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
protected void btnTest_Click(object sender, EventArgs e)
{
lblTest.Text = RadioButtonList1.SelectedItem.Text + " hello";
PopupControlExtender.GetProxyForCurrentPopup(this.Page).Commit(RadioButtonList1.SelectedValue);
// Reset the selected item
RadioButtonList1.ClearSelection();
}
我不能讓HTML到 – arame3333 2009-10-29 10:46:42
你嘗試過移動PopupControlExtender Panel1的外部問題呈現? – 2009-10-29 12:40:54