c# - How to prevent Chart1.DataSource=null? -


chartid.datasourceid="sqldatasourceid" if again give chartid.datasourceid=datatable reference business logic

if throws error saying can't use both datasources...,remove one.

on removing datasource, while calling chartid.databind(); on hitting breakpoint, realized datasource=null occurs after post condition.

please guide me in eliminating error.

here design:

<asp:chart id="chart1" runat="server" datasourceid="sqldatasource2" imagelocation="~/tempimages/chartpic_#seq(300,3)" imagestoragemode="useimagelocation"> <series>  <asp:series name="series1" charttype="pie" chartarea="chartarea1" xvaluemember="target_category" yvaluemembers="orders" color="green" xvaluetype="string" yvaluetype="double" > </asp:series>  </series>  <chartareas>  <asp:chartarea name="chartarea1" >  <area3dstyle enable3d="true" rotation="90" inclination="0"/> </asp:chartarea> </chartareas>  </asp:chart> 

here code:

chart1.series["series1"].xvaluemember = "target_category";  chart1.series["series1"].yvaluemembers = "orders";  chart1.series["series1"]["pielabelstyle"] = "outside";  chart1.series["series1"]["pointwidth"] = "0.1";  int user_id = user_id;  sessionparameter spuid = new sessionparameter(); spuid.name = "user_id";  spuid.type = typecode.int32;  spuid.sessionfield =convert.toint32( session["user_id"]).tostring();  chart1.datasourceid = "sqldatasource1";  chart1.databind() ; chart1.visible = true; 


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -