c# - DataBinding exception that says system.data.datarow does not contain a property with the name -


lacking asp.net experience, have been trying resolve issue last 3 days without success. databinding:system.data.datarowview not contain name 'reci_seq' exception getting when changed code display gridview.

i had below code working fine:

<asp:tablecell width="57%">   <asp:linkbutton id="lnkdname" runat="server" onclick="lnkdname_click"></asp:linkbutton> <asp:label runat="server" id="lbldtag"></asp:label></asp:tablecell>.................... 

but when changed below codes start getting exception:

<asp:gridview id="grddevicedown" runat="server" width="100%" cellpadding="0"  cellspacing="1" autogeneratecolumns="false"           onrowdatabound="grddevicedown_rowdatabound"           onrowdeleting="grddevicedown_rowdeleting"            onrowcommand="grddevicedown_rowcommand" gridlines="none"> <columns>    <asp:templatefield itemstyle-width="15%">      <itemtemplate>         <asp:label runat="server" id="lbldevicedown" text="device down"></asp:label>      </itemtemplate>    </asp:templatefield>       <asp:templatefield itemstyle-width="57%">         <itemtemplate>            <asp:linkbutton id="lnkdname" runat="server"                commandname="modify"                 commandargument='<%# eval("reci_seq") +"," +eval("pims_status") %>'>                                            <%# eval("shortname") %>               </asp:linkbutton>           <i>(<%# eval("pims_tag_id") %>)</i>          </itemtemplate>       </asp:templatefield>.......... 

below how aspx.cs code looks like:

protected void grddevicedown_rowcommand(object sender, gridviewcommandeventargs e) {      if (e.commandname == "upd")     {         string evntseq = e.commandargument.tostring();         viewstate["devicedwnevntseq"] = evntseq;      }     if (e.commandname == "modify")     {         string[] args = e.commandargument.tostring().split(new char[] { ',' });         viewstate["rddown"] = args[0];         viewstate["rddownpimsstatus"] = args[1];         viewstate["pimstagselection"] = "ddownupd";         grddevicedown.selectedindex = convert.toint32(e.commandargument);         openpimstagselectionpopup();     }  } protected void grddevicedown_rowdatabound(object sender, gridviewroweventargs e)  {    e.row.cells[6].visible = false;    e.row.cells[7].visible = false;    if (e.row.rowtype == datacontrolrowtype.datarow)    {        int reciseq = 0;        string pimsstatusd = string.empty;        string onvald = string.empty;        string offvald = string.empty;        string onfuncd = string.empty;        string offfuncd = string.empty;        int donval = 0;        int doffval = 0;         datarow dr = ((datarowview)e.row.dataitem).row;        pimsstatusd = dr["pims_status"].tostring();        reciseq = convert.toint32(dr["reci_seq"]);        system.web.ui.webcontrols.label lbldtag = (system.web.ui.webcontrols.label)e.row.findcontrol("lbldtag");         string frmseq = dr["frrm_seq"].tostring();        viewstate["frmseq"] = frmseq;          onfuncd = dr["on_function"].tostring();        offfuncd = dr["off_function"].tostring();        if (onfuncd == "ds")        {            donval = convert.toint32(dr["on_value_ds"].tostring());        }        else        {            donval = convert.toint32(dr["on_value"].tostring());        }         if (offfuncd == "ds")        {            doffval = convert.toint32(dr["off_value_ds"].tostring());        }        else        {            doffval = convert.toint32(dr["off_value"].tostring());        }         if (pimsstatusd == "inactive")        {            lbldtag.text = "inactive";        }        else        {            onvald = utilities.convertsymbol(onfuncd);            onvald += donval;            offvald = utilities.convertsymbol(offfuncd);            offvald += doffval;         }         system.web.ui.webcontrols.label lblonval = (system.web.ui.webcontrols.label)e.row.findcontrol("lbldonval");        system.web.ui.webcontrols.label lbloffval = (system.web.ui.webcontrols.label)e.row.findcontrol("lbldoffval");        lblonval.text = onvald;        lbloffval.text = offvald;         system.web.ui.webcontrols.button btnmodify = (system.web.ui.webcontrols.button)e.row.findcontrol("btnmodify");        btnmodify.attributes.add("onclick", "javascript : popswitch(" + convert.toint32(btnmodify.commandargument.tostring()) + ");");    } 

}


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -