Reputation: 15197
I have some textbox's who's values are all empty when i try retrieve there values from the behind code after a post back submit.
My submit button:
<ICCM:ICCMImageButton ID="btnSubmit" runat="server" meta:resourcekey="btnResSubmit" onclick="btnSubmit_Click" PostBack="true" style="float:right; padding-right:5px;" TabIndex="23"/>
Behind C# code:
protected void btnSubmit_Click(object sender, EventArgs e)
{
//code
objCmd.Parameters.Add("@FirstName", SqlDbType.NVarChar, 50).Value = txtFName.Text.ToString();
//more code
}
Page load:
btnSubmit.ClickScript = "if(ValidatePage() == false){return false}; this.disabled = true; document.getElementById(this.getAttribute('ControlID') + 'Text').innerHTML = '" + Resources.ICCMCPortal.Submitting + "';";
OnInt:
btnSubmit.Page = this.Page;
The text value is always "" unless i pre populated the textbox in the page load then the text will be that regardless if i made a change to it.
Upvotes: 0
Views: 216
Reputation: 15197
Set you textbox values inside here:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SetTextboxValues();
}
}
This way the wont be reset on postback.
Upvotes: 1