产品使用及交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

xiyou求解答,CS0165: 使用了未赋值的局部变量“dr”,请问该怎... [复制链接]

1#
行51是错误的,我想将value值改成<%=dr["content"]%>,可是修改后的页面就显示:CS0165: 使用了未赋值的局部变量“dr”,不知道该怎么给dr复制呢

行 49: <div class="feedback_box"><div class="tit">在线提问<a name="ask"></a></div>
行 50: <ul><li style="float: left; width: 100px; height: 2px; text-align: right"><span style="color: #ff0000"></span></li>
[color=Red]行 51: <li style="float: left"><input class="f_tb" id="title" maxlength="50" size="55" name="title" type="hidden" value="<%=dr["content"]%>" /></li>[/color]
行 52: <li style="clear: both; font-size: 1px; line-height: 0px; height: 2px">&nbsp;</li>
行 53: <li style="float:left; width:100px;height:20px;text-align:right"><span style="color: #ff0000">*</span>您的邮箱:</li>


这是完整的代码
<script src="/e/js/feedback.js" type="text/javascript"></script>
<form action="/e/aspx/post.aspx" method="post" enctype="multipart/form-data" name="feedback">
<div class="feedbackask_box">
<span class="tit">在线问答</span>
<p class="con">共48个问题,已回答48个 <a href="#ask">我要提问</a></p>
</div>
</script>
<!---留言列表区--->
<div class="feedbacklist_box">
<%
int i,k;
DataTable dt,dt1;
DataRow dr,dr1;
dt=Get_Data();
for(i=0;i<dt.Rows.Count;i++)
{
dr=dt.Rows[i]; //说明:给dr赋值
%>
<ul class="feedbacklist_item_box">
<li style="background:url(/e/images/public/wd_ico_03.png) no-repeat 0 -53px;padding:0 0 0 25px;">
留言:<span>提问者:<%=dr["pa_truename"].ToString()%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=dr["thedate"]%></span></li>
<li><a href="<%=Detail_Url(dr)%>" target="<%=Target%>" <%=Server.HtmlEncode(dr["content"].ToString())%>><%=SubStr(dr["content"].ToString(),280,true)%></a></li>
<%
if(dr["reply_state"].ToString()=="1")
{
dt1=Get_Reply("feedback",int.Parse(dr["id"].ToString()));  
for(k=0;k<dt1.Rows.Count;k++)
{
dr1=dt1.Rows[k]; //说明:给dr赋值
%>
<li class="feedbacklist_item_jiange"></li>
<li style="background:url(/e/images/public/wd_ico_03.png) no-repeat 0 -100px;padding:0 0 0 25px;colorff6600">回复:<span><%=dr1["thedate"].ToString()%></span></li>
<li><%=SubStr(dr1["reply"].ToString(),280,true)%></li>
<%
}
}
%>
</ul>
<%
}
%>
</div>
<div class="feedback_box"><div class="tit">在线提问<a name="ask"></a></div>
<ul><li style="float: left; width: 100px; height: 2px; text-align: right"><span style="color: #ff0000"></span></li>
<li style="float: left"><input class="f_tb" id="title" maxlength="50" size="55" name="title" type="hidden" value="<%=dr["content"]%>" /></li>
<li style="clear: both; font-size: 1px; line-height: 0px; height: 2px">&nbsp;</li>
<li style="float:left; width:100px;height:20px;text-align:right"><span style="color: #ff0000">*</span>您的邮箱:</li>
<li style="float: left"><input class="f_tb" id="email" maxlength="30" name="email" type="text" size="15"/></li>
<li style="float: left"><span style="color: #ff0000">&nbsp;*</span>联系人:<input class="f_tb" id="pa_truename" maxlength="30" size="10" name="pa_truename" type="text" /></li>
<li style="float: left">&nbsp;电话:<input class="f_tb" id="pa_tel" maxlength="30" size="12" name="pa_tel" type="text" /></li>
<li style="clear: both; font-size:1px; line-height:0px;height: 2px">&nbsp;</li>
<li style="float: left; margin: 30px 0px 0px; width: 100px; text-align: right"><span style="colorff0000">*</span>留言内容:</li>
<li style="float: left; padding-bottom: 5px; padding-top: 5px"><textarea id="content"  name="content" rows="5" cols="70" onblur="if(this.value.length&gt;250)this.value=this.value.substr(0,250)" class="f_tb" ></textarea> <span style="color: #ff0000">*</span></li>
<li style="clear: both; font-size: 1px; line-height: 0px; height: 2px">&nbsp;</li>
<li style="float: left; width: 100px; height: 20px; text-align: right"><span style="color: #ff0000">*</span>验证码:</li>
<li style="float: left"><input class="f_tb" id="vcode" maxlength="4" size="4" name="vcode" type="text" /><img id="vcode_img" alt="点击更换" hspace="2" align="absMiddle" border="0" onclick="Code_Change('vcode_img')" style="cursor:pointer" src="/e/aspx/yzm.aspx" /></li>
<li style="clear: both;font-size: 1px; line-height:0px; height:2px">&nbsp;</li>
<li style="clear: both;padding:5px 0 5px 95px"><input type="hidden"  name="sort" value="555" /><input class="button" type="submit" onclick="return set_feedback()" value=" 提交 " /> <input class="button" type="reset" value=" 重设 " /></li></ul>
</div>
<input type="hidden" name="checkyzm" value="1" /> <input type="hidden" name="checked" value="0" /> <input type="hidden" name="to" /> <input type="hidden" name="mailto" /> <input type="hidden" name="mailreply" /> <input type="hidden" name="mailsubject" /> <input type="hidden" name="mailbody" /> <input type="hidden" name="sendmail" value="0" /> <input type="hidden" name="insertdatabase" value="1" /> <input type="hidden" name="siteid" value="1" /> <input type="hidden" name="formtable" value="feedback" />
</form>
<script type="text/javascript">
function set_feedback()
{
document.forms["feedback"].mailto.value="";
document.forms["feedback"].mailreply.value="";
document.forms["feedback"].mailsubject.value="";
document.forms["feedback"].mailbody.value="";
return Check_Feedback();
}
</script>
分享 转发
TOP
发新话题 回复该主题