Hi all,
I have a CheckBox in a datagrid called DataFinAdjust. The Autopostback properties of the checkbox is set to true. At each post back i want to be able to do an update using other columns of the datagrid as unique identifiers. The challenge i have is that the ItemCommand event is not fired when the checkbox is either checked or unchecked. And figured out that if i used the checkedchanged event of the checkbox i'll have difficulty to get the row index of the datagrid at which the checkbox was checked or unchecked.
My code is as follow sombody please help.

protected void DataFinAdjust_ItemCommand(object source, DataGridCommandEventArgs e)
	   	var FieldID =  e.Item.Cells[13].Text;
	   	var Account = e.Item.Cells[14].Text;
	   	var cotflag = (CheckBox) e.Item.Cells[7].FindControl("chkcotflag");

	   	var fincost = new FinancialCostAdjustment(appConfiguration.ConnectionString)

					    AcctCode = Account,
					    cotflag = cotflag.Checked,
					    ID = Convert.ToInt32(FieldID)

8 Years
Discussion Span
Last Post by ema005

Do you have a column set as a datakey for the gridview? You usually need one for what you're trying to do.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.