I have a textbox and this is how I assigned value into it
var start = moment().subtract(6, \'days\');
var end = moment();
$(\'#datePicker\').daterangepi
if this line cb(start,end);
overwrite your text box on post back, then do that.
Add on aspx page one literal to render the variable isPostBack
as javascript.
<asp:Literal runat="server" ID="txtExtraScriptVariables" EnableViewState="false" />
Then on code behind render it.
txtExtraScriptVariables.Text
= string.Format("var isPostBack = {0};", IsPostBack.ToString().ToLower());
and now on your script use it as
if(!isPostBack)
cb(start,end);