调用代码我有这样与事件复选框:如何从背后服务器端
protected void cbRating1WithoutExceptionP1_CheckedChanged(object sender, EventArgs e)
{
if (cbRating1WithoutExceptionP1.Checked == true)
{
cbRating1WithExceptionP1.Checked = false;
cbRating1WithExceptionP1.Enabled = false;
}
else
{
cbRating1WithExceptionP1.Enabled = true;
}
}
如何调用从服务器端的活动?
foreach (string oWithException in oWithExceptions)
{
switch (oWithException.Trim())
{
case "P1":
cbRating2WithExceptionP1.Checked = true;
cbRating1WithoutExceptionP1_CheckedChanged(new object, new EventArgs);
break;
case "P2":
cbRating2WithExceptionP2.Checked = true;
break;
case "P3":
cbRating2WithExceptionP3.Checked = true;
break;
case "P4":
cbRating2WithExceptionP4.Checked = true;
break;
case "P5":
cbRating2WithExceptionP5.Checked = true;
break;
case "NOT_ALLOWED":
cbRating2WithExceptionNotAllowed.Checked = true;
cbRating2WithExceptionP1.Checked = false;
cbRating2WithExceptionP1.Enabled = false;
cbRating2WithExceptionP2.Checked = false;
cbRating2WithExceptionP2.Enabled = false;
cbRating2WithExceptionP3.Checked = false;
cbRating2WithExceptionP3.Enabled = false;
cbRating2WithExceptionP4.Checked = false;
cbRating2WithExceptionP4.Enabled = false;
cbRating2WithExceptionP5.Checked = false;
cbRating2WithExceptionP5.Enabled = false;
break;
}
}
}
像这样:
cbRating1WithoutExceptionP1_CheckedChanged(new object, new EventArgs);
是不是可以调用从服务器端的事件,而不创建一个函数?
你从服务器side.This事件调用事件的意思是已经在服务器端。 – 2015-02-11 06:30:33
使用这样'cbRating1WithoutExceptionP1_CheckedChanged(空,新EventArgs.Empty);' – 2015-02-11 06:31:49
或拉动相关代码到另一个方法无论是从事件处理程序和您的其他地方 – 2015-02-11 06:35:46