Jump to content

Update GridView control ???


nobitavn94

Recommended Posts

Hi all,I have a grid view control (named GridQuestion) and an xml file.I bound xml file to grid view control as follow :1.Using a dataset to read xml file.2.Assign the dataset to data source property of grid view.3.Databound.In GridVew_RowUpdating event ,I get new value that user enter : protected void GridQuestion_RowUpdating(object sender, GridViewUpdateEventArgs e){ GridViewRow row= GridQuestion.Rows[e.RowIndex]; Textbox txtbox =(TextBox)row.FindControl("txtQuestion"); ....}but I cannot get new value user entered. txtbox.Text contains the old value before user enter.How can I get new value that user enter ?Thank you !

Link to comment
Share on other sites

The event handling (_RowUpdating) happens after the Load event on the page. If you have code in your Page_Load handler that binds the XML file to the GridView, then it may be overwriting what the user has inputted. If this is the case, try putting the databinding code like this:

protected void Page_Load(object sender, EventArgs e){	if(!Page.IsPostBack)	{		// databinding code goes here and only		// runs if the page hasn't been posted back.	}}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...