前台代码:通过Repeater列表记录行(多行),每一行前页有一个供选择的:<input name="check" ID="LID" type="checkbox" value="<%# Eval("ID") %>" />有个按钮:执行操作
执行操作事件中:
string IDstr = Request.Form["check"].ToString();当check有选择的时候,代码正常;但是当check无任何选择时提示出错:未将对象引用设置到对象的实例。行 91: protected void Button1_Click(object sender, EventArgs e)
行 92: {
行 93: string IDstr = Request.Form["check"].ToString();
行 94: //string IDstr2 = Request.Form["LID"].ToString();
行 95: Response.Write("<scripr>alert('删除失败!"+IDstr+"');</script>");
请各位指点,谢谢
执行操作事件中:
string IDstr = Request.Form["check"].ToString();当check有选择的时候,代码正常;但是当check无任何选择时提示出错:未将对象引用设置到对象的实例。行 91: protected void Button1_Click(object sender, EventArgs e)
行 92: {
行 93: string IDstr = Request.Form["check"].ToString();
行 94: //string IDstr2 = Request.Form["LID"].ToString();
行 95: Response.Write("<scripr>alert('删除失败!"+IDstr+"');</script>");
请各位指点,谢谢
解决方案 »
- Ajax加载下在进度,消息: Sys.WebForms.PageRequestManagerParserErrorException: 无法分析从服务器收到的消
- Spacebuilder怎么实现同时登陆,注册 等功能啊
- 请教大量实例化实体类对性能影响大吗?
- 在ashx中输出HTML
- a.html?name="sdfdsf"传参问题Request.QueryString
- 用process调用C语言编译成的程序时input和output出错
- 如何取年份的后两位
- 帮忙看看,那里有错,小弟刚开始接触.net
- web安装以后卸载不了??
- 如何在DATAGRID中加一栏
- 关于页面验证的entire
- 一个关于oralce存储过程调用的问题~
{
//////
}或者在前台直接用非空验证控件。
改下。Request.Form["check"]==null?"":Request.Form["check"].ToString();
{
string IDstr = Request.Form["check"];
if (Request.Form["check"]!="" && Request.Form["check"]!=null)
{
string IDstr2 = Request.Form["check"].ToString();
Response.Write("<scripr>alert('有选择!');</script>"); }else
{
Response.Write("<scripr>alert('请选择再进行操作!');</script>");
}
}