Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm working on asp.net web aplication. I'm creating a temporary DataTable for which I need to assign some values from GridView.

In GridView Some Columns have more than one controls. example, To display DateTime I'm using calendar to pick date and three dropdowns to display hh:mm:ss. so these values make one column. Now I want to use these values. For one Column RuleNumber its very simple. Please help me.

This is the code.

DropDownList localDropDownRuleNumber = (DropDownList)grvStudentDetails.Rows[rowIndex].Cells[1].FindControl("dropDownRuleNumber");
 TextBox localTextBoxStartDate = (TextBox)grvStudentDetails.Rows[rowIndex].Cells[2].FindControl("StartDateTime");
                    DropDownList localDropDownStartHour = (DropDownList)grvStudentDetails.Rows[rowIndex].Cells[2].FindControl("StartHourDropDown");
                    DropDownList localDropDownStartMinute = (DropDownList)grvStudentDetails.Rows[rowIndex].Cells[2].FindControl("StartMinute");
                    DropDownList localDropDownStartSec = (DropDownList)grvStudentDetails.Rows[rowIndex].Cells[2].FindControl("StartSS");



This is temporary datatable.

C#
drCurrentRow = dtCurrentTable.NewRow();
                    drCurrentRow["RowNumber"] = i + 1;


this is how I'm assigning values.

SQL
dtCurrentTable.Rows[i - 1]["Col1"] = localDropDownRuleNumber.SelectedValue;
                    dtCurrentTable.Rows[i - 1]["Col2"] = localTextBoxStartDate.Text;
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900