您能否让我知道为什么以下代码不起作用,当调试器通过变量“strStatus”时我收到错误消息。错误消息是:“对象引用未设置为对象的实例。” 你能帮忙吗?谢谢-Yagya
protected void Button1_Click(object sender, EventArgs e)
{
if (Y0130_chkNew.Checked == true)
{
bool isChecked = true; // This is required for later retrieval.
string strAction = "Reporting";
string strFromRole = ddSelectRole.SelectedValue;
string TxtBoxID = myProject.getTextBox(strAction, strPath);
TextBox txtb = new TextBox();
txtb = (TextBox)Page.FindControl(TxtBoxID);
string strStatus = txtb.Text;
string ddID = myProject.getDropDown(strAction, strPath);
DropDownList ddLst = new DropDownList;
ddLst = (DropDownList)Page.FindControl(ddID);
string strForwardRole = ddLst.SelectedValue;
// Call the function now
my.updateXML(strFromRole, strAction, strStatus, strForwardRole, strPath);
}
}