ASP.NET Web Forms GridView RowUpdating Event Not Getting New Values From Controls
I have a code in rowupdating event which get's values from textbox controls during edit mode. However, when update command button is clicked, the values from the controls were cleared or null. So, I checked the page load event, and found out that I have a code which rebinds the grid when it is not post back since the update link button will trigger postback. Here is the page load code:
So, the modified pageload code should add a IsPostback condition so that the binding of gridview will not be executed. Here's the modified script:
if(!string.IsNullOrEmpty(Request.QueryString["LoanNum"])) { ShowToControls(Convert.ToInt32(Request.QueryString["LoanNum"])); BindGridDetails(Convert.ToInt32(Request.QueryString["LoanNum"])); }
if(!string.IsNullOrEmpty(Request.QueryString["LoanNum"]) && !Page.IsPostBack) { ShowToControls(Convert.ToInt32(Request.QueryString["LoanNum"])); BindGridDetails(Convert.ToInt32(Request.QueryString["LoanNum"])); }
Comments
Post a Comment