Hi All..
This Code Write On aspx file .This Code set the value in hidden field..But This Code Does not Work Properly

    <script type= "text/javascript">
        function showDialogue() {
            var a = Screen.Width;
            var b = Screen.hieght;
            document.getElementById('HiddenField1').value = a;
            document.getElementById('HiddenField2').value = b;
    <form id="form1" runat="server"  >
     <asp:HiddenField ID="HiddenField1" runat="server"  />
     <asp:HiddenField ID="HiddenField2" runat="server"  /> 

in code Behind ::
On page Load Am Calling JavaScript function.
Page.ClientScript.RegisterStartupScript([GetType](), "MyKey", "showDialogue();", True)
I am also Calling Javascript in Another way:
Dim localScreenWidth As String = " <script type='text/javascript'>showDialogue();</script>"
then retrive The Hidden Field..
Label2.Text = HiddenField1.Value
But I am Not getting any Hidden field value.Give me a Idea ,How I am getting Hiddenfield value???

If you have the clientside function already written in the aspx file you don't need to register it server side.

I'm also not sure what you are doing here:

Dim localScreenWidth As String = " <script type='text/javascript'>showDialogue();</script>"

Basically call the javascript clientside to update the hidden field values then in the page post back read the values server side

Remember the page has two sides, Client which is run on the browser and server. The only way the server side knows what is happening client side is if the data page is posted back to the server.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.