0

Hi all,
I have set readonly property of text box as true. Coz i dont want user to be able to change it's value. It is going to contain date value, which will be inserted into it by an Ajax Calendar control. But when i accept their values in code file, it shows value as blank !! Aftwerwards I changed readonly property false before accepting value in code file, but still the same result.
How is this happening? Plz help
P.s I dont want to use labels

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Shantanu88d
0

javaScript Code:

<script language="javascript" type="text/javascript">
        function showDate() {
            var date = document.getElementById('txtDate').value.toString();
            document.getElementById('selectedDate').value = date;

        }
 </script>

page.aspx:

<asp:Button ID="btnGetDate" 
   runat="server" 
   OnClick="btnGetDate_Click" 
   Text="Button" 
   OnClientClick="showDate()"/>

<input id="selectedDate" type="hidden" runat="server" />

code behind:

protected void btnGetDate_Click(object sender, EventArgs e)
        {
            string Date = selectedDate.Value.ToString();
        }
0

Personally i use the property enabled="False" if i want no body touch that textbox, in the only situation i use read only is when play around with gridview.

regards

0

It is not the problem of Readonly Propert.

You are changing the value from Javascript which will change the values only in the client side and will not affect the server Value.

That is why you are getting the Original Value. You need to change the Textbox values from server side

0

I have observed that this problem is specific to Ajax controls. In the txtbox i am accepting value from Ajax Calendar Control. Only there reasd only gives problem. In all other cases everything's fine !

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.