Sr no in Datagrid
-
I want to show on Column called Sr No in my datagrid. At runtim this column will show values like 1,2,3.... for each selected row based on the records available in dataset. How to acheive this!!!!!!! Thanks, Mini Thomas
-
I want to show on Column called Sr No in my datagrid. At runtim this column will show values like 1,2,3.... for each selected row based on the records available in dataset. How to acheive this!!!!!!! Thanks, Mini Thomas
you can create an Autoincrement column and seed by 1 and bind with sr. no column. Be :) Bye
-
I want to show on Column called Sr No in my datagrid. At runtim this column will show values like 1,2,3.... for each selected row based on the records available in dataset. How to acheive this!!!!!!! Thanks, Mini Thomas
hi, here is the code to display Sr No. in datagrid. In the following code loadDs is dataset. if (loadDs.Tables.Count > 0) { loadConsultant.Tables[0].Columns.Add(new DataColumn("Sl_NO", System.Type.GetType("System.String"))); foreach (DataTable table in loadConsultant.Tables) { int i = 1; foreach (DataRow row in table.Rows) { foreach (DataColumn column in table.Columns) { row["Sl_NO"] = i.ToString(); } i = i + 1; } } } Regards,
Prya
-
I want to show on Column called Sr No in my datagrid. At runtim this column will show values like 1,2,3.... for each selected row based on the records available in dataset. How to acheive this!!!!!!! Thanks, Mini Thomas
hi, Use the autoincrement column as told by arvind rather than looping through the dataset. using autoiuncrement column is more efficient than going through loops. thanks, Kapil Thakur (Where's there is Kapil , there is a way)
-
hi, here is the code to display Sr No. in datagrid. In the following code loadDs is dataset. if (loadDs.Tables.Count > 0) { loadConsultant.Tables[0].Columns.Add(new DataColumn("Sl_NO", System.Type.GetType("System.String"))); foreach (DataTable table in loadConsultant.Tables) { int i = 1; foreach (DataRow row in table.Rows) { foreach (DataColumn column in table.Columns) { row["Sl_NO"] = i.ToString(); } i = i + 1; } } } Regards,
Prya
Hello Prya, In ur code how do I bind the row with Datagrid also there is error on line foreach (DataColumn column in table.Columns) { can u help mi out Thanks, Mini Thomas