I have a GridView with which I am populating 3 columns with data from a SQL table. The columns are populated after an ontextchanged event. The data populates the columns just fine, however the data is erased when I add a new row to the GridView by clicking the update button. The data returns if I click on the GridView edit button. The columns I am manually completing do not erase after adding a row. Also, it appears that the data I am populating from the SQL table appears in the GridView column as a label instead of inside of the column text box.
Whenever there is a postback, the gridview retrieves the data from the Form Data.
I recommend you to modify the GridView in the form data itself by using the FormData object:
Example:
this.FormData.Tables["REQUEST_GRIDVIEW1"].Rows.Clear();
System.Data.DataRow newRow = this.FormData.Tables["REQUEST_GRIDVIEW1"].NewRow();
newRow[0] = "Value of 1st column";
newRow[1] = "Value of 2nd column";
newRow[2] = "Value of 3rd column";
this.FormData.Tables["REQUEST_GRIDVIEW1"].Rows.Add(newRow);
this.FormData.Tables["REQUEST_GRIDVIEW1"].AcceptChanges();
this.SaveFormData(this.FormData);
this.BindFormDataToFields(this.FormData);
Adding .Controls[0]).Text to both gridview cell assignments allowed the gridview columns textbox to be populated with sql data instead of populating the column with sql data as a label. I don’t know if that makes a lot of sense, but that is the best way I can describe how the sql data was appearing in the gridview before it disappeared on update.
@eddy.daouk Hello eddy , i need to retrieve data from sql table and insert it into gridview , i 'am beginner in workflowgen and i don’t know how to do that . Can you help me please ? thanx