asp.net - Index was out of range. Must be non-negative and less than the size of the collection - chart databind -



asp.net - Index was out of range. Must be non-negative and less than the size of the collection - chart databind -

i'm trying build datatable , bind gridview , chart object. gridview appears fine when build x,y array , bind them chart object error above.

i've read many forums understand index looking @ field out of range i've queried in immediate window fields , values there. there error occurs bind chart object , don't know why chart object doesn't display properly.

this aspx codebehind:

dim dt datatable = new datatable() dt.columns.add("companyname") dt.columns.add("amount") dt.columns.add("proportion") using dbcontext new fundmatrixentities dim queryunits = (from c in dbcontext.units c.savingapplicationid = savappid select new {.loanappid = c.loanapplicationid}).distinct().tolist() dim companyname string = "" dim savingsamount string = "" dim totalproportion string = "" dim totalsavingsamount string = "" each loan in queryunits if not loan.loanappid nil companyname = classsqldirect.execquery("select companyname companyprofile loanapplicationid='" & loan.loanappid.tostring & "'") savingsamount = classsqldirect.execquery("select sum(amount) unit savingapplicationid='" & savappid.tostring & "' , loanapplicationid='" & loan.loanappid.tostring & "'") totalsavingsamount = classsqldirect.execquery("select amount savingapplication savingapplicationid='" & savappid.tostring & "'") totalproportion = ((savingsamount / totalsavingsamount) * 100) & "%" dt.rows.add(companyname, savingsamount, totalproportion) end if next gvwbusinesses.datasource = dt gvwbusinesses.databind() end using dim x string() = new string(dt.rows.count - 1) {} dim y string() = new string(dt.rows.count - 1) {} integer = 0 dt.rows.count - 1 x(i) = dt.rows(i)(0).tostring() y(i) = dt.rows(i)(2).tostring() next chart1.series(0).points.databindxy(x, y) chart1.series(0).charttype = seriescharttype.pie

the code errors on line

chart1.series(0).points.databindxy(x, y)

can help me?

asp.net vb.net data-binding charts

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -