use hidden field on page set it's value in validation function and after calling Page.ClientScript.RegisterStartupScript() retrive it from hidenfield
exa.
<asp:HiddenField id="HiddenField1" runat="server" />
<script type="text/javascript">
//in javascript fist check for postback becose it is registered on page load
function validate()
{
var chkPostBack = '<%= Page.IsPostBack ? "true" : "false" %>';
if (chkPostBack == 'true')
{
if(!confirm('Are you Sure to submit your File or Data?'))
{
document.getElementById('<%= HiddenField1.ClientID %>').value=0;
}
$.showprogress();
}
else
document.getElementById('<%= HiddenField1.ClientID %>').value=1;
}
</script>
on code behind retrive it from hiddenfield.But first register fuction using RegisterStartupScript on page
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ScriptManager.RegisterStartupScript(this, typeof(string), "alert", "validate();", true);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "validate();", true);
int result1=Convert.ToInt32(HiddenField1.Value);
}