asp Repeater의 특정 행에 액세스하고 해당 버튼을 비활성화하려면 어떻게합니까? 이 프로그램은 모든 아래쪽 버튼을 비활성화합니다. userId가 Database에 있는지 확인하고 싶습니다. 위로 버튼을 비활성화하고 아래쪽 버튼 만 활성화해야합니다.리피터의 버튼 비활성화
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 (isOwner(userID) == true)
{
Button b = e.Item.FindControl("btnmoveup") as Button;
b.Enabled = false;
}
public bool isOwner(string user_ID)
{
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", user_ID);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{
return true;
}
else
{
return false;
}
connection.Close();
}
}
을하는 데 도움이
.enabled = '<%# eval(is_enabled) %>'
희망은 가난한 관행을 나타냅니다. – Candide
그리고 프로그램은 어떻게됩니까? 약간의 오류가 있습니까? JQuery를 사용해 보셨습니까? –
http://tinypic.com/r/1793pk/6 이것은 내가 원하는 것입니다 ... 모든 버튼이 오른쪽에서 활성화되어 있습니다 ... 내 이름 옆에있는 버튼을 활성화하면됩니다. – Pradit