HTML部分代码:游>RadioButtonList事件:protected void rdoMode_T_SelectedIndexChanged(object sender,EventArgs e){ID_Area_Line();}部分代码:public static string strID_World;public static string strName_World;public static string strID_Area
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 15:46:28
HTML部分代码:游>RadioButtonList事件:protected void rdoMode_T_SelectedIndexChanged(object sender,EventArgs e){ID_Area_Line();}部分代码:public static string strID_World;public static string strName_World;public static string strID_Area
HTML部分代码:
游>
RadioButtonList事件:
protected void rdoMode_T_SelectedIndexChanged(object sender,EventArgs e)
{
ID_Area_Line();
}
部分代码:
public static string strID_World;
public static string strName_World;
public static string strID_Area;
public static string strName_Area;
public static string strUrl;
protected void Page_Load(object sender,EventArgs e)
{
if IsPostBack)
{
if (Request.PathInfo.Length = 0)
{
labID_Area.Text = Common.SqlSafety.CutBadStr(Request.PathInfo.Substring(1));
PageSetBind();
Navigation();
ID_Area_Place();
Mode_T();
Place_T();
ID_Area_Line();
}
}
}
protected void Mode_T()
{
string strSql = "select distinct a.ID_Mode,a.Name_Mode from Mode_T a inner join Line_T b on b.ID_Mode_Line like '%'+a.ID_Mode+'%' where b.ID_Area_Line like '%" + strID_Area + "%' ";
System.Data.DataSet ds = Maticsoft.DBUtility.DbHelperSQL.Query(strSql);
if (ds.Tables[0].Rows.Count > 0)
{
rdoMode_T.DataSource = ds;
rdoMode_T.DataValueField = "ID_Mode";
rdoMode_T.DataTextField = "Name_Mode";
rdoMode_T.DataBind();
rdoMode_T.Items.Insert(0,new System.Web.UI.WebControls.ListItem("不限","0"));
rdoMode_T.SelectedIndex = 0;
}
}
本地很正常,上传到服务器后,选择RadioButtonList按钮会出现如下错误:
Object reference not set to an instance of an object.
或者
Invalid postback or callback argument.Event validation is enabled using in configuration or in a page.For security purposes,this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.If the data is valid and expected,use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
请问是什么原因?
HTML部分代码:游>RadioButtonList事件:protected void rdoMode_T_SelectedIndexChanged(object sender,EventArgs e){ID_Area_Line();}部分代码:public static string strID_World;public static string strName_World;public static string strID_Area
第一个是未将对象引用到实例,
在事件 ID_Area_Line中出现null对象,但是你又使用了此对象 这样就报错了
第二个时参数安全问题 需要将 enableEventValidation 设置成false,或者再使用postback、CallBack的地方 需要使用 ClientScriptManager.RegisterForEventValidation 进行注册.