tags:

views:

161

answers:

1

in C# i am just trying to create a common function for creating a gridview. here the user just passes the gridview column type, caption and the field name. these parameters are of type string.

so can any one help me out, how to convert the column type which is passed as string to the respective grid data column data type??? (one simple solution could be by using if conditions - such that compare the input parameter and create the respective object. but i just want to avoid as it would be much costly.)

thanks and regards Malathy.L.

A: 

Try this:

Type.GetType(columnType)

e.g.

table.Columns.Add(columnName, Type.GetType(columnType) );
codeulike
Hi... I need to create a grid column of type the input parameter string. so its something like this.. GridView.Columns.Add("the String - the column type")here when we use type.GetType("") - it doesnt get converted to GridViewColumn type.. so can u guest me what to be done on dis?ThanksMalathy.L.
Malathy