string username;
string userid;
if (Session["UserName"] == null || CheckBox3.Checked==true)
{
username = "佚名";
userid = "10000";
}
else
{
username = Session["UserName"].ToString();
userid = Session["UserID"].ToString();
}
这个if判断没效果,未登录用户执行if下面的语句,但是登陆用户选了checkbox却不能执行if下的语句
登陆用户不管是否选中checkbox都是执行else中的语句下面是html的code
<asp:Panel ID="Panel3" runat="server" Visible="False">
<div>无聊图:</div>
<div style="margin:10px 40px 0 50px"><asp:Label ID="Label5" runat="server" BackColor="#CC0000" ForeColor="#FFFFCC"
style="text-align: center" Text="Label" Visible="False" Width="470px"></asp:Label>
</div>
<div>
<span style="width:50px">图片:</span>
<span>
<asp:TextBox ID="TextBox5" runat="server" Height="100px"
TextMode="MultiLine" Width="465px"><img src=""/></asp:TextBox>
</span>
</div>
<div>
<span style="width:50px">标签:</span>
<span>
<asp:TextBox ID="TextBox6" runat="server" Width="467px"></asp:TextBox>
</span>
</div>
<div style="margin-top:5px">
<span style="margin-left: 47px">
<asp:Button ID="Button6" runat="server" Height="25px" onclick="Button6_Click"
Text="提交" Width="200px" />
</span>
<span style="margin-left: 20px">
<asp:CheckBox ID="CheckBox3" runat="server" Text="匿名发表" /></span>
</div>
</asp:Panel>
页面用一个button来控制panel的visible为true
string userid;
if (Session["UserName"] == null || CheckBox3.Checked==true)
{
username = "佚名";
userid = "10000";
}
else
{
username = Session["UserName"].ToString();
userid = Session["UserID"].ToString();
}
这个if判断没效果,未登录用户执行if下面的语句,但是登陆用户选了checkbox却不能执行if下的语句
登陆用户不管是否选中checkbox都是执行else中的语句下面是html的code
<asp:Panel ID="Panel3" runat="server" Visible="False">
<div>无聊图:</div>
<div style="margin:10px 40px 0 50px"><asp:Label ID="Label5" runat="server" BackColor="#CC0000" ForeColor="#FFFFCC"
style="text-align: center" Text="Label" Visible="False" Width="470px"></asp:Label>
</div>
<div>
<span style="width:50px">图片:</span>
<span>
<asp:TextBox ID="TextBox5" runat="server" Height="100px"
TextMode="MultiLine" Width="465px"><img src=""/></asp:TextBox>
</span>
</div>
<div>
<span style="width:50px">标签:</span>
<span>
<asp:TextBox ID="TextBox6" runat="server" Width="467px"></asp:TextBox>
</span>
</div>
<div style="margin-top:5px">
<span style="margin-left: 47px">
<asp:Button ID="Button6" runat="server" Height="25px" onclick="Button6_Click"
Text="提交" Width="200px" />
</span>
<span style="margin-left: 20px">
<asp:CheckBox ID="CheckBox3" runat="server" Text="匿名发表" /></span>
</div>
</asp:Panel>
页面用一个button来控制panel的visible为true
解决方案 »
- C#控制台程序怎么调用cmd的命令
- 用C#去开发一个交互式的CAD系统需要哪些知识?
- ◎→ 我知道很可能没人解答了. 不过还是再开一贴加100分.
- 请问一个数组的问题.
- installshield 制作安装程序,高分请教,愿另开贴给100分!!!
- File or assembly name Microsoft.Office.Interop.Word,or one of its dependencies,was not found.
- 查询
- 【求助】服务器要装支持asp.net2.0的东东
- c#中有没有类似vb中的公共变量的东西?
- C#DataGridView如何利用选中单元格的tag属性如何设置
- 请问如何在宿主中根据instanceID获取当前状态机工作流所处的状态?
- 关于panel的mousemove被控件遮挡后无响应的问题
{
CheckBox chb = (CheckBox)c.FindControl("CheckBox3");
if ( chb.Checked == false)
{
username = "佚名";
userid = "10000";
} else
{
username = Session["UserName"].ToString();
userid = Session["UserID"].ToString();
}试过这样遍历也不行。。
else就等价Session["UserName"] != null && CheckBox3.Checked!=true
看看是否成立