Friday, 15 August 2014

c# - How do I bind Data from my DataTable to Gridview -



c# - How do I bind Data from my DataTable to Gridview -

i elaborate. trying description failed payment , want hover on image or status see reason description failed payment:

here c# info bound gridview

datatable billingdt = new datatable(); billingdt = q.getbillhistory(sessionvars.current.varcontractid); billingdt.columns.add("paynum", system.type.gettype("system.string")); billingdt.columns.add("datestr", system.type.gettype("system.string")); billingdt.columns.add("amountstr", system.type.gettype("system.string")); billingdt.columns.add("balancestr", system.type.gettype("system.string")); billingdt.columns.add("description", system.type.gettype("system.string")); string downpayment = dt.select("name = 'downpayment'")[0][1].tostring(); (int row = 0; row < billingdt.rows.count; row++) { billingdt.rows[row]["paynum"] = billingdt.rows[row]["payment"].tostring(); billingdt.rows[row]["datestr"] = convert.todatetime(billingdt.rows[row]["paydate"]).toshortdatestring(); if (billingdt.rows[row]["payment"].tostring() == "0") { billingdt.rows[row]["paynum"] = downpayment; } if (billingdt.rows[row]["status"].tostring().length < 1) { billingdt.rows[row]["status"] = ""; } if (billingdt.rows[row]["descript"].tostring().length < 1) { billingdt.rows[row]["description"] = ""; } if (billingdt.rows[row]["amount"].tostring().length > 0) { billingdt.rows[row]["amountstr"] = fv.moneystring(convert.todecimal(billingdt.rows[row]["amount"])); } billingdt.rows[row]["balancestr"] = (billingdt.rows[row]["balance"].tostring().length > 0) ? fv.moneystring(convert.todecimal(billingdt.rows[row]["balance"])) : ""; } billinghistorygv.datasource = billingdt; billinghistorygv.databind();

and here asp:image want bind description tooltip:

<asp:templatefield> <itemtemplate> <asp:image id="statusiconimg" runat="server" imageurl='<%# getimage((string)eval("status")) %>' /> </itemtemplate> <itemstyle horizontalalign="right" width="20px" /> </asp:templatefield>

if understanding question correctly, not have bind tooltip property of image? tooltip='<%# eval("description") %>'

<asp:image id="statusiconimg" runat="server" imageurl='<%# getimage((string)eval("status")) %>' tooltip='<%# eval("description") %>' />

c# asp.net gridview

No comments:

Post a Comment