You must Sign In to post a response.
Category: ASP.NET
#766401
Hi
Ofcourse
Whether in our aspx Page is postback we canot track the client side value.
defiantly looses value in javascript because javascript is client side script .
Page post event firing server side so that situation page re rendering so we canot capture the client side value
try to use server side then using ajax panel thats better for you.
for ex : try this code
Name : Dotnet Developer-2015
Email Id : kumaraspcode2009@gmail.com
'Not by might nor by power, but by my Spirit,' says the LORD Almighty.
Ofcourse
Whether in our aspx Page is postback we canot track the client side value.
defiantly looses value in javascript because javascript is client side script .
Page post event firing server side so that situation page re rendering so we canot capture the client side value
try to use server side then using ajax panel thats better for you.
for ex : try this code
<asp:ScriptManager ID="ScriptManager"
runat="server" />
<asp:UpdatePanel ID="UpdatePanel1"
UpdateMode="Conditional"
runat="server">
<ContentTemplate>
<fieldset>
<legend>UpdatePanel content</legend>
<!-- Other content in the panel. -->
<%=DateTime.Now.ToString() %>
<br />
<asp:Button ID="Button1"
Text="Refresh Panel"
runat="server" />
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
Name : Dotnet Developer-2015
Email Id : kumaraspcode2009@gmail.com
'Not by might nor by power, but by my Spirit,' says the LORD Almighty.
#766402
if you change the value of this control through javascript in the client side it will not be propagated via postback in the serverside...whatever you do with javascript unless you remove readonly="true". Now there is a solution to this problem as described in the article above.
Simply put this in the PageLoad event
Just don't forget to remove ReadOnly="true" or Enable="false" if your intent was to disable the control from editing just use the snippet above. Don't forget to remove Enable="false" if you put it on.
Thanks
Koolprasd2003
Editor, DotNetSpider MVM
Microsoft MVP 2014 [ASP.NET/IIS]
Simply put this in the PageLoad event
if (!IsPostBack)
txtName.Attributes.Add("readonly","readonly");
Just don't forget to remove ReadOnly="true" or Enable="false" if your intent was to disable the control from editing just use the snippet above. Don't forget to remove Enable="false" if you put it on.
Thanks
Koolprasd2003
Editor, DotNetSpider MVM
Microsoft MVP 2014 [ASP.NET/IIS]
#766407
Hi,
I guess using HiddenField you can achieve your task, instead of Label control try to use hidden field that was helpful to you. Apart from the above try to overcome postback in a page by using AJAX UpdatePanel.
Hope this will helpful to you....
--------------------------------------------------------------------------------
Give respect to your work, Instead of trying to impress your boss.
N@veen
Blog : http://naveens-dotnet.blogspot.in/
I guess using HiddenField you can achieve your task, instead of Label control try to use hidden field that was helpful to you. Apart from the above try to overcome postback in a page by using AJAX UpdatePanel.
<asp:UpdatePanel ID="upCancel" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:ImageButton ID="btnCancelYes" OnClick="btnCancelYes_Click" runat="server" ImageUrl="~/Images/btnyes.jpg" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnCancelYes" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Hope this will helpful to you....
--------------------------------------------------------------------------------
Give respect to your work, Instead of trying to impress your boss.
N@veen
Blog : http://naveens-dotnet.blogspot.in/
Return to Return to Discussion Forum