create gridview dynamically
when i click Add button i need to create grid开发者_StackOverflowview dynamically, where the gridview has to contain Textbox,DatePicker and dropdownlist.where as the values entered in each row of the gridview have to store it in database and retrive.
To get you started, an object is generally created dynamically in C# like this:
DataGridView g = new DataGridView();
The rest of the stuff you're asking - the textbox, datepicker, dropdownlist columns and reading/writing to the database - is quite involved and can't be answered here in any simple way.
You can just Bind the GridView
onClick
of Add
Button
Like this
protected void btnADD_Click(object sender, EventArgs e)
{
objENT = new ENT();//using n-tier Architecture
objENT.ProcType = "ProcedureType";
DataSet ds = BLL.ProcessGrid(objENT);
GridviewDisplay.DataSource = ds;
GridviewDisplay.DataBind();//GridviewBind
}
I have used stored Procedure here,You can use any other methods as u wish
精彩评论