110,568
社区成员
发帖
与我相关
我的任务
分享
<asp:DropDownList ID="DDL_department" runat="server"
DataSourceID="SqlDataSource1" DataTextField="UserName" DataValueField="UserId">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:FaxViewConnectionString %>"
SelectCommand="SELECT [UserId], [UserName] FROM [user]"></asp:SqlDataSource>
前台的源,这个我怎么判断啊,不太懂,在前台
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if(!string.IsNullOrEmpty(Session["UserName"].ToString()))
{
if ( Session["UserName"].ToString() != "admin")
{
DDL_department.SelectedValue= Session["UserName"].ToString();
DDL_department.Enabled = false;
}
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if ( Session["UserName"].ToString() != "admin")
{
DDL_department.SelectedValue= Session["UserName"];
DDL_department.Enabled = false;
}
}