c# - Unrecognized Guid format -
i working on c# application getting error.
here stack track of error:
stack trace: @ system.guid.guidresult.setfailure(parsefailurekind failure, string failuremessageid, object failuremessageformatargument, string failureargumentname, exception innerexception) @ system.guid.tryparseguid(string g, guidstyles flags, guidresult& result) @ system.guid..ctor(string g) @ projects_addproject.wizcreateproject_activestepchanged(object sender, eventargs e) @ system.web.ui.webcontrols.wizard.onactivestepchanged(object source, eventargs e) @ system.web.ui.webcontrols.wizard.multiviewactiveviewchanged(object source, eventargs e) @ system.web.ui.webcontrols.multiview.onactiveviewchanged(eventargs e) @ system.web.ui.webcontrols.multiview.set_activeviewindex(int32 value) @ system.web.ui.webcontrols.wizard.set_activestepindex(int32 value) @ projects_addproject.proxy_navigate(object sender, historyeventargs e) @ system.web.ui.scriptmanager.raisenavigate(historyeventargs e) @ system.web.ui.scriptmanager.loadhistorystate(string serverstate) @ system.web.ui.scriptmanager.raisepostbackevent(string eventargument) @ system.web.ui.scriptmanager.system.web.ui.ipostbackeventhandler.raisepostbackevent(string eventargument)
from error happening when converting string guid. method occurs wizcreateproject_activestepchanged.it looks guid conversion issue.
here method generate error:
protected void wizcreateproject_activestepchanged(object sender, eventargs e) { switch (wizcreateproject.activestepindex) { case 0: if (rbfrmtemp.checked) { int tenantid = tenantutils.gettenantid(page); ezproject templateproject = dbaccessprojects.getproject(tenantid, new guid(ddlprojtemplates.selectedvalue)); txnme.text = templateproject.projectname; txdesc.text = templateproject.projectdescription; checkloadworktype(tenantid, ddlwrktype); if (templateproject.worktypeid != null) { listitem workitem = ddlwrktype.items.findbyvalue(templateproject.worktypeid.tostring()); if (workitem != null) { ddlwrktype.selectedvalue = templateproject.worktypeid.tostring(); } } if (templateproject.projecttype == (int)projecttype.reoccurring) { checkgroupedradiobutton(rbreoccurring); txbilfreq.text = templateproject.billingfrequency.tostring(); if (templateproject.lastdate != null) { txtdate.text = ((datetime)templateproject.lastdate).toshortdatestring(); } listitem prditem = ddlbilprd.items.findbyvalue(templateproject.billingperiod); if (prditem != null) { ddlbilprd.selectedvalue = prditem.value; } scriptmanager.registerclientscriptblock(uppnlproject, typeof(updatepanel), uppnlproject.clientid, "typechanged();", true); wizcreateproject.activestepindex = 2; } else { wizcreateproject.activestepindex = 3; } btnadd.visible = true; } else { if (rbreoccurring.checked) { scriptmanager.registerclientscriptblock(uppnlproject, typeof(updatepanel), uppnlproject.clientid, "typechanged();", true); } } break; case 3: txnme.focus(); scriptmanager.registerclientscriptblock(uppnlproject, typeof(updatepanel), uppnlproject.clientid, "initnames();", true); break; default: break; } }
the error here:
ezproject templateproject = dbaccessprojects.getproject(tenantid, new guid(ddlprojtemplates.selectedvalue));
you can see internally guid constructor using guid.tryparse()
should doing. add validator ddlprojtemplates make required , need make sure contains valid guids.
Comments
Post a Comment