사용자 ID를 수락하고 동일한 ID를 가진 프로젝트 소유자가 있는지 확인하고 싶습니다. 프로젝트 소유자가있는 경우 "아래로 이동"버튼을 사용하고 다른 모든 버튼은 비활성화해야합니다. 관리자가 있으면 모든 버튼이 활성화되고 첫 번째 이동은 위로 이동하고 마지막 이동은 아래로 이동합니다. POwner가 userID와 동일한 버튼 이외의 버튼을 모두 비활성화하고 싶습니다! 합니다 (POwner는 사용자 ID와 동일한 경우에만 버튼이 활성화되어야한다 아래로 이동합니다.로그인 한 사용자에 따라 버튼을 비활성화하십시오.
public void Repeater1_ItemDatabound(Object Sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
String userID = User.Identity.Name.Split('\\')[1];
if (setvisibility(userID) == true) //Check if the person is Admin all buttons work
{
if (e.Item.ItemIndex == 0)
{
Button b = e.Item.FindControl("btnmoveup") as Button;
b.Enabled = false;
}
DataView view = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
DataTable result = view.ToTable();
if (e.Item.ItemIndex == (result.Rows.Count) - 1)
{
Button b2 = e.Item.FindControl("btnmovedown") as Button;
b2.Enabled = false;
}
}
else // Check if Project Owner (POwner exists) Check if userID exists in POwner
{
using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["ctd_priority_dbConnectionString"].ConnectionString))
{
connection.Open();
SqlCommand cmd = new SqlCommand("Select POwner from Projects WHERE POwner = @userid", connection);
cmd.Parameters.AddWithValue("@userid", userID);
SqlDataReader reader = cmd.ExecuteReader();
그리고 귀하의 질문은 무엇입니까? –
은 asp-classic과 전혀 관련이 없습니다. – ulluoink
POwner가 userID와 동일한 버튼 이외의 모든 버튼을 비활성화하고 싶습니다! – Pradit