I am trying to get value of Javascript variable on server side, but it always shows values on second button click and I don't want to reload this page again

    protected void Button1_Click(object sender, EventArgs e)

        Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>setValues();</script>");

Javascript Code . . . ..

<script type="text/javascript">

    function setValues()
        var abc = "thi is first";
        document.getElementById('<%=HiddenField1.ClientID%>').value = abc;


Related posts

Recent Viewed