Hi,
it is possible for you to make the text field readonly (ReadOnly=True) as opposed to making it Disabled=True? The reason being that if textfield is disabled is not submitted with the form in the POST request.
1st Solution
Use ReadOnly instead of Enable property
2nd Solution
or you need to use HiddenFiled and set textbox value in it,and get its value on save click
<div>
<script type="text/javascript">
function OnTextKeyUp(txt) {
document.getElementById("txtConfirEmail").value = txt.value;
document.getElementById("hfConfirEmail").value = txt.value;
}
</script>
<table cellpadding="5" cellspacing="5">
<tr>
<td>
Email:
</td>
<td>
<asp:TextBox ID="txtEmail" runat="server" onkeyup="OnTextKeyUp(this);" />
</td>
</tr>
<tr>
<td>
Confirm Email:
</td>
<td>
<asp:TextBox ID="txtConfirEmail" runat="server" ReadOnly="true" />
<asp:HiddenField ID="hfConfirEmail" runat="server" />
</td>
</tr>
</table>
<asp:Button Text="Save" runat="server" OnClick="Save" />
</div>
C#
protected void Save(object sender, EventArgs e)
{
string confirEmail = hfConfirEmail.Value;
}
I hope this will help you out.