| | |
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 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv gridview gudi iis javascript list listbox login menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers






