Hi,
I am having a editable gridview which is populated on the click of "Load Data" button.
For saving the edited values in the grid, there is another button called "Save" on the same page.
On clicking save button, the page is getting posted back and gridview values are getting cleared, due to which i am not able to save the latest data.
I am working on ASP.Net 4.0
Any help would be greatly appreciated.
Code of .cs file --
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
populateDropDown();
}
}
protected void btnLaunchTour_Click(object sender, EventArgs e)
{
try
{
populateGrid(TourLaunchDAL.LaunchTour(0, Convert.ToInt32(ddlProduct.SelectedValue), Convert.ToInt32(txtNoOfTours.Text), UserDetails.UserID));
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
}
}
protected void populateGrid(List<TourLaunchBAL> lstTourSchedule)
{
grdTourSchedule.DataSource = lstTourSchedule;
grdTourSchedule.DataBind();
}
protected void populateDropDown()
{
ListItem lstItem = new ListItem("Select", "0");
ddlProduct.AppendDataBoundItems = true;
ddlProduct.Items.Add(lstItem);
ddlProduct.DataSource = CacheMaster.getProductsForLaunch();
ddlProduct.DataTextField = "ProductName";
ddlProduct.DataValueField = "ProductID";
ddlProduct.DataBind();
}
protected void grdTourSchedule_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
protected void grdTourSchedule_RowDataBound(object sender, GridViewRowEventArgs e)
{
}
protected void btnSave_Click(object sender, EventArgs e)
{
foreach (GridViewRow gvRow in grdTourSchedule.Rows)
{
}
}
Thanks