أريد أن أقوم بتعبئة DropDownList حسب صلاحية المستخدم... الـ DropDownList هذا موجود داخل DetailsView الذي يقوم بإدخال القيم إلى قاعدة بيانات...
المشكلة أنه جميع القيم يتم إدخالها ما عدا القيمة اللي مفروض يجي من الـ DropDownList هذا الكود اللي عندي:
{
if (User.IsInRole("مدراء"))
{
DropDownList Employees = (DropDownList)DetailsView1.FindControl("DropDownList1");
if (Employees != null)
{
SqlDataSource ddlSqlDataSource = new SqlDataSource();
ddlSqlDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["SalariesConnectionString1"].ToString();
ddlSqlDataSource.SelectCommandType = SqlDataSourceCommandType.Text;
ddlSqlDataSource.SelectCommand = "SELECT EmployeeNo, Fullname FROM Employees";
//ddlSqlDataSource.SelectParameters.Add("DeptNo", DeptNo.ToString());
Employees.DataSource = ddlSqlDataSource;
Employees.DataTextField = "Fullname";
Employees.DataValueField = "EmployeeNo";
Employees.DataBind();
}
}
}
protected void DetailsView1_DataBound(object sender, EventArgs e)
{
DDLemployee();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DDLemployee();
}
}
public void DDLemployee()
