| | |
Problem getting the row index of a datagrid
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2006
Posts: 22
Reputation:
Solved Threads: 4
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.
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.
ASP.NET Syntax (Toggle Plain Text)
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) }; fincost.UpdateCOTFLAG(); }
Emmanuel Balogun
Senior .Net Developer
Precise Financial Systems
Lagos-Nigeria.
Senior .Net Developer
Precise Financial Systems
Lagos-Nigeria.
![]() |
Similar Threads
- Deleting a checked row from datagrid/database ? (C#)
- Problem in getting the selected index value of a drop down list in a datagrid (ASP.NET)
- get row index of the selected item ! (ASP.NET)
- how to get row index of datareader withput a use of variable (ASP.NET)
- Adding new row in DataGrid (C#)
- How To highlight a row or a column in a datagrid....? (ASP.NET)
- Getting Current Row Values in the DataGrid control (ASP.NET)
- Anyway to display the Row Number in DataGrid? (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Base clase
- Next Thread: grid view with fixed header
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dropdownlist dropdownmenu dynamic edit embeddingactivexcontrol expose findcontrol flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list login menu microsoft mono mssql multistepregistration nameisnotdeclared numerical objects order panelmasterpagebuttoncontrols problem ratings rotatepage save schoolproject search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment webservice wizard xml youareanotmemberofthedebuggerusers






