I have a Rad gridview that databinds and popluates date according to a seacrh. There is a linkbutton that i want to be able to change on column from saying false to true or vice-versa. Please help

protected void rgUsers_ItemCreated(object sender, GridItemEventArgs e)
 {
    if (e.Item is GridDataItem)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        LinkButton btn1 = (LinkButton)dataItem["btnChange"].Controls[0];
        btn1.Click += new EventHandler(btn1_Click);
    }
}

protected void rgUsers_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        LinkButton btn1 = (LinkButton)dataItem["btnChange"].Controls[0];
        btn1.CommandArgument = string.Format("return Click(' {0}';", (e.Item as GridDataItem)
            ["CustomID"].Text);
    }
}

void btn1_Click(object sender, EventArgs e)
{
    var btnChange = (LinkButton)sender;

}

Inside btn1_Click event I have a linq statement as follows:

  var change = from c in db.Users
               where c.AccountID == ?? 
               select c;

I need to be able to get the correct row in which I clicked the button to change its one column value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.