javascript - Error when using ScriptManager to close current window and open another one -
i have problem when executing below line of code, want show success message , closing current window , open one.
scriptmanager.registerclientscriptblock(this, this.gettype(), "alertmessage", "alert(' progress has been finished '), window.close(), window.open('reqprogdetail.aspx?v=0&codlic="+ convert.toint32(_idlicense) + "#section1') ", true);
my hiddenfield :
hiddenfield _idlicense = (hiddenfield)dv.findcontrol("hid_id_license");
and exception message :
system.invalidcastexception: unable cast object of type 'system.web.ui.webcontrols.hiddenfield' type 'system.iconvertible'. @ system.convert.toint32(object value)
you're getting error because you're trying convert hiddenfield
object int, have retrieve value in hiddenfield
object first before converting int
.
try changing part of code:
convert.toint32(_idlicense)
into :
convert.toint32(_idlicense.value)
Comments
Post a Comment