我正在尝试根据用户指定隐藏按钮。登录后,我正在从数据库中获取“名称”。而Emp_Id来自页面遮罩。
没有任何想法。我这个Emp_Id没有得到。
namespace Board_Meeting.Pages
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label User = (Label)Page.Master.FindControl("User_Name");
if (Session["Emp_Id"] != null)
{
var cnnString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
string User_Designation_Value = "Select Designation from [User] where Emp_id='" + User.Text + "'";
string User_Designation;
using (SqlConnection cnn = new SqlConnection(cnnString))
{
cnn.Open();
SqlCommand Get_User_Designation = new SqlCommand(User_Designation_Value, cnn);
Get_User_Designation.CommandType = CommandType.Text;
User_Designation = Get_User_Designation.ExecuteScalar().ToString();
}
}
}
protected void Create_Agenda_Click(object sender, EventArgs e)
{
Response.Redirect("/Pages/CreateAgenda.aspx");
}
protected void B_View_Edit_Click(object sender, EventArgs e)
{
Response.Redirect("/Pages/EditAgenda.aspx");
}
}
}