Hi friends,
I Have gridview by default no columns declared in the aspx page. I declared the columns dynamically based on the requirement. I have a subject dropdownlist control ,inwhich selectedIndexchanged event I created dynamic columns(label,and textbox) show in the page.. For label control I bind the data from database and for Textbox i just enter the data from here. Outside the gridview I Have the button for save this gridview value to database.In button click event i would like call the gridview data for saving in the database. But I Have an issue with gridview state level.In this button click event postback, gridview loses their data value,so i cannot able to read the data from gridview. what is my task is I want to read the gridview data to save to database. help me.
I post my code previously. but no result. i tried my level best.
how can maintain viewstate for gridview for different postback[^]
Loading

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 4, 2013, 10:25 AM EDT
baskaran chellasamy112 reputationPosted Oct 4, 2013, 9:44 PM EDT
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 6, 2013, 1:14 AM EDT
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
protected void BindGrid()
{
//Based on the dropdown selection, create column here
GridView1.DataSource = CreateDataSource();
GridView1.DataBind();
}