我问的是sql server2005还是什么? 你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" /> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Button1.Enabled = false; string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了 if (admin == "管理员") { this.Button1.Enabled = true; } else if (admin == "普通用户") { this.Button1.Enabled = true; } } protected void Button1_Click(object sender, EventArgs e) { } }如果楼主还不懂的话,我也没有办法了
我问的是sql server2005还是什么? 你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" /> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Button1.Enabled = false; string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了 if (admin == "管理员") { this.Button1.Enabled = true; } else if (admin == "普通用户") { this.Button1.Enabled = true; } } protected void Button1_Click(object sender, EventArgs e) { } }如果楼主还不懂的话,我也没有办法了 if(admin=="管理员") ? 难道等号后就写“管理员”这三个字吗
我问的是sql server2005还是什么? 你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" /> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Button1.Enabled = false; string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了 if (admin == "管理员") { this.Button1.Enabled = true; } else if (admin == "普通用户") { this.Button1.Enabled = true; } } protected void Button1_Click(object sender, EventArgs e) { } }如果楼主还不懂的话,我也没有办法了 if(admin=="管理员") ? 难道等号后就写“管理员”这三个字吗 我问的是sql server2005还是什么? 你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" /> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Button1.Enabled = false; string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了 if (admin == "管理员") { this.Button1.Enabled = true; } else if (admin == "普通用户") { this.Button1.Enabled = true; } } protected void Button1_Click(object sender, EventArgs e) { } }你说 string admin= 什么叫我要的效果啊
你的Session是登录者的用户名吧 你的sql语句应该写成 string admin="select admin from usermsg where ID='"+Session["ID"].Tostring+"'" 就可以了
你的Session是登录者的用户名吧 你的sql语句应该写成 string admin="select admin from usermsg where ID='"+Session["ID"].Tostring+"'" 就可以了出现问题:object不包括Tostring的定义,并且找不到可接受类型为object的第一个参数方法string
同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
新注册普通用户权限怎么自动为0
同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
新注册普通用户权限怎么自动为0
你可以设置字段默认的默认值为0
同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
新注册普通用户权限怎么自动为0
你可以设置字段默认的默认值为0
你可以加个if条件
if(管理员)
{
this.botton1.Enable=true;
}
else if(其他用户)
{
this.botton1.Enable=false;
}
同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
新注册普通用户权限怎么自动为0
你可以设置字段默认的默认值为0
你可以加个if条件
if(管理员)
{
this.botton1.Enable=true;
}
else if(其他用户)
{
this.botton1.Enable=false;
}默认值怎么设呢 ,还有这括号里代码是什么啊 就是(管理员)(其他用户)
同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
新注册普通用户权限怎么自动为0
你可以设置字段默认的默认值为0
你可以加个if条件
if(管理员)
{
this.botton1.Enable=true;
}
else if(其他用户)
{
this.botton1.Enable=false;
}默认值怎么设呢 ,还有这括号里代码是什么啊 就是(管理员)(其他用户)
而且还说不包括Button1的定义,并找不到类型为“主页”的第一个参数的扩展方法Button1 button1第一个字母我是用的大写的
同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
新注册普通用户权限怎么自动为0
你可以设置字段默认的默认值为0
你可以加个if条件
if(管理员)
{
this.botton1.Enable=true;
}
else if(其他用户)
{
this.botton1.Enable=false;
}默认值怎么设呢 ,还有这括号里代码是什么啊 就是(管理员)(其他用户)
而且还说不包括Button1的定义,并找不到类型为“主页”的第一个参数的扩展方法Button1 button1第一个字母我是用的大写的
你的数据库是什么?
你是准备做什么?窗体应用程序还是web?
很简单的呀,就是判断是谁登陆的,看他是管理员还是普通用户。
数据库名yhgl 我想知道具体的代码
你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Button1.Enabled = false;
string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了
if (admin == "管理员")
{
this.Button1.Enabled = true;
}
else if (admin == "普通用户")
{
this.Button1.Enabled = true;
}
}
protected void Button1_Click(object sender, EventArgs e)
{ }
}如果楼主还不懂的话,我也没有办法了
你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Button1.Enabled = false;
string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了
if (admin == "管理员")
{
this.Button1.Enabled = true;
}
else if (admin == "普通用户")
{
this.Button1.Enabled = true;
}
}
protected void Button1_Click(object sender, EventArgs e)
{ }
}如果楼主还不懂的话,我也没有办法了
if(admin=="管理员") ? 难道等号后就写“管理员”这三个字吗
你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Button1.Enabled = false;
string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了
if (admin == "管理员")
{
this.Button1.Enabled = true;
}
else if (admin == "普通用户")
{
this.Button1.Enabled = true;
}
}
protected void Button1_Click(object sender, EventArgs e)
{ }
}如果楼主还不懂的话,我也没有办法了
if(admin=="管理员") ? 难道等号后就写“管理员”这三个字吗 我问的是sql server2005还是什么?
你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Button1.Enabled = false;
string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了
if (admin == "管理员")
{
this.Button1.Enabled = true;
}
else if (admin == "普通用户")
{
this.Button1.Enabled = true;
}
}
protected void Button1_Click(object sender, EventArgs e)
{ }
}你说 string admin= 什么叫我要的效果啊
你的Session是登录者的用户名吧
你的sql语句应该写成 string admin="select admin from usermsg where ID='"+Session["ID"].Tostring+"'"
就可以了
你的Session是登录者的用户名吧
你的sql语句应该写成 string admin="select admin from usermsg where ID='"+Session["ID"].Tostring+"'"
就可以了出现问题:object不包括Tostring的定义,并且找不到可接受类型为object的第一个参数方法string
赋值 Session["ID"]=登录者的用户名;
获取 string admin=Session["ID"]
楼主 你一定要给我加分