How to pass multiple rows from one gridview to another
gridview after clicking the checkbox.
Answer / srividhya
int i;
DataTable ObjDT = new DataTable();
DataColumn objcol1 = new DataColumn();
objcol1.DataType =
System.Type.GetType("System.Int16");
objcol1.ColumnName = "Category_id";
ObjDT.Columns.Add(objcol1);
DataColumn objcol2 = new DataColumn();
objcol2.DataType =
System.Type.GetType("System.String");
objcol2.ColumnName = "Category_Name";
ObjDT.Columns.Add(objcol2);
DataColumn objcol3 = new DataColumn();
objcol3.DataType =
System.Type.GetType("System.String");
objcol3.ColumnName = "Description";
ObjDT.Columns.Add(objcol3);
DataColumn objcol4 = new DataColumn();
objcol4.DataType =
System.Type.GetType("System.String");
objcol4.ColumnName = "Messages";
ObjDT.Columns.Add(objcol4);
for (i = 0; i < radGridView1.Rows.Count; i++)
{
if
(radGridView1.Rows[i].Cells[0].Value.ToString().ToUpper() ==
"TRUE")
{
DataRow ObjRow = ObjDT.NewRow();
ObjRow["Category_Id"] =
radGridView1.Rows[i].Cells[1].Value;
ObjRow["Category_Name"] =
radGridView1.Rows[i].Cells[2].Value;
ObjRow["Description"] =
radGridView1.Rows[i].Cells[3].Value;
ObjRow["Messages"] =
radGridView1.Rows[i].Cells[4].Value;
ObjDT.Rows.Add(ObjRow);
}
}
radGridView2.DataSource = ObjDT;
foreach (GridViewDataColumn column in
radGridView2.Columns)
{
column.BestFit();
}
Is This Answer Correct ? | 4 Yes | 1 No |
Coding for Manipulate XML File Data Using C#?
Write a program to count 3Letter, 4Letter and 5Letter words from a file and print the number of 3Letter, 4Letter and 5Letter words. Delimiter is space, tab, hifen. Also we should not consider the line in the file after we encounter # in that line.
How to Link Different Data Sources Together?
program for string reverse(eg:- i am boy -> boy am i)
8 Answers Black Pepper, Infosys, Mind Tree,
How to export 2 datatables of a single dataset to 2 different worksheets of a single MSExcel file ?
working with arrays
Can you declare an array of mixed Types?
Give the code for Handling Mouse Events?
. Write a program to print the following outputs using for loops $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
How to add a value from textBox over an existing certain column in SQL Server
c# coding for a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors not using the Big-integer and Exponential Function's.
Write a program to convert postfix expression to infix expression.