PDA

View Full Version : load dữ liệu từ gridview lên textbox bằng LinQ



trungocvan
28-10-2010, 08:37
trong hàm if()mình muốn lấy dữ liệu cho txtPassword.text trong cột Password nhưng không thể gọi được dữ liệu trong gridview
Mong mọi người chỉ giúp mình.
đây là code xử lý xự kiện textchanged của mình:

protected void Txtuser_TextChanged(object sender, EventArgs e)
{
var user_accout = from selectuser in db.USER_ACCOUNTs where selectuser.UserName.Equals(Txtuser.Text) select selectuser;
int i = -1;
foreach (var user in user_accout)
{
Txtuser.Text=user.UserName;
i++;
}
if (i == 0)
{
Buttonthem.Visible = false;
Buttonsua.Visible = true;
Buttonxoa.Visible = true;
Txtuser.Visible = false;
DropDownList1.Visible = false;
//mình muốn lấy dữ liệu cho txtpass.text= cột password trong griedview
}
else
{
Buttonthem.Visible = true;
}
}

minhquang12g
29-10-2010, 21:16
Hồi trước mình cũng gán dữ liệu vào ô textbox với kiểu password nhưng nó không hiển thị. Còn lý do vì sao thì ko bt :D