Reputation: 8636
I am writing a condition like:
if (dt > 0)
{
objinvoice.editInvoice(strInvoice, strRenew, strExpiry);
GridView1.EditIndex = -1;
bindGrid();
}
I will have a radio button in gridview if that radiobutton is initially set to false and if the condition is true I would like to set it to true ....
Upvotes: 0
Views: 656
Reputation: 3224
You can do this in gridview itemdatabound event. You can check the condition and change the radiobutton status.
Gridview ItemDataBound example:
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==System.Web.UI.WebControls.ListItemType.EditItem)
RadioButton rBtnTest = e.Item.FindControl("radiobutton id") as RadioButton;
// Check condition and if it's true
if(your_condition == true)
rBtnTest.Checked = true;
else
rBtnTest.Checked = false;
}
Upvotes: 1