
DropDownList 回发取值问题
绑定:protectedvoidPage_Load(objectsender,EventArgse){if(!Page.IsPostBack){NType.DataSou...
绑定:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
NType.DataSource = tags.GetList(1, 2);
NType.DataTextField = "Title";
NType.DataValueField = "TID";
NType.DataBind();
}
}
NType_SelectedIndexChanged:
protected void NType_SelectedIndexChanged(object sender, System.EventArgs e)
{
NSort.ClearSelection();
NSort.DataSource = tags.GetList(int.Parse(NType.SelectedValue.ToString()), 1);
NSort.DataTextField = "Title";
NSort.DataValueField = "TID";
NSort.DataBind();
}
aspx:
<asp:DropDownList ID="NType" runat="server" OnSelectedIndexChanged="NType_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
头部:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="newsadd.aspx.cs" Inherits="FoodAdmin_web_newsadd" EnableEventValidation="false"%>
生成:
<select name="NType" onchange="javascript:setTimeout('__doPostBack(\'NType\',\'\')', 0)" language="javascript" id="NType">
<option selected="selected" value="5">P一</option>
<option value="6">P二</option>
</select>
问题:
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument; //对象不支持此属性或方法
theForm.submit();
}
}
// -->
</script>
选择其它项时提示 脚本//对象不支持此属性或方法
并且不回发,DropDownList值也不改变 展开
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
NType.DataSource = tags.GetList(1, 2);
NType.DataTextField = "Title";
NType.DataValueField = "TID";
NType.DataBind();
}
}
NType_SelectedIndexChanged:
protected void NType_SelectedIndexChanged(object sender, System.EventArgs e)
{
NSort.ClearSelection();
NSort.DataSource = tags.GetList(int.Parse(NType.SelectedValue.ToString()), 1);
NSort.DataTextField = "Title";
NSort.DataValueField = "TID";
NSort.DataBind();
}
aspx:
<asp:DropDownList ID="NType" runat="server" OnSelectedIndexChanged="NType_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
头部:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="newsadd.aspx.cs" Inherits="FoodAdmin_web_newsadd" EnableEventValidation="false"%>
生成:
<select name="NType" onchange="javascript:setTimeout('__doPostBack(\'NType\',\'\')', 0)" language="javascript" id="NType">
<option selected="selected" value="5">P一</option>
<option value="6">P二</option>
</select>
问题:
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument; //对象不支持此属性或方法
theForm.submit();
}
}
// -->
</script>
选择其它项时提示 脚本//对象不支持此属性或方法
并且不回发,DropDownList值也不改变 展开
展开全部
你的页面上是不是有个按钮,它的ID是不是等于“submit”?如果有,把这个ID改成其它的。按钮的ID 不能为submit
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询