asp.net - Cannot hide Panel in Grdivew - Object reference not set to an instance of an object -
i trying hide panel in gridview
object reference not set instance of object.
here code using:
protected sub gvtally_rowdatabound(sender object, e system.web.ui.webcontrols.gridviewroweventargs) handles gvtally.rowdatabound if e.row.cells(2).text = "incomplete" dim panelhide panel = ctype(e.row.findcontrol("panel1"), panel) panelhide.visible = false else dim panelhide panel = ctype(e.row.findcontrol("panel1"), panel) panelhide.visible = true end if end sub
and here gridview:
<asp:gridview id="gvtally" runat="server" enablemodelvalidation="true" allowsorting="true" onrowdatabound="gvtally_rowdatabound" class="table table-condensed table-striped table-bordered table-hover no-margin" autogeneratecolumns="false" font-size="small"> <columns> <asp:boundfield datafield="company" headertext="company"> <itemstyle width="180px" /> </asp:boundfield> <asp:boundfield datafield="submitted" headertext="submitted" /> <asp:boundfield datafield="variance" headertext="variance" /> <asp:boundfield datafield="accepted" headertext="accepted" /> <asp:templatefield headertext="action" showheader="false"> <itemtemplate> <asp:button id="button3" runat="server" cssclass="btn btn-warning btn-small" text="unaccept" commandname="unaccept" visible="false" /> <asp:button id="button2" runat="server" cssclass="btn btn-success btn-small hidden-phone" text="accept" commandname="accept" /> <asp:panel id="panel1" runat="server"> <a href="#accsettings3" role="button" class="btn btn-success btn-small hidden-phone" data-toggle="modal" data-original-title="">accept </a> <div id="accsettings3" class="modal hide fade" tabindex="-3" role="dialog" aria-labelledby="mymodallabel3" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button> <h4 id="mymodallabel3">accept validation </h4> </div> <div class="modal-body"> <div class="row-fluid"> sure want accept tally variance off? </div> </div> <div class="modal-footer"> <asp:button id="btnacceptchanges" class="btn btn-primary" runat="server" text="yes" /> <button class="btn" data-dismiss="modal" aria-hidden="true"> no </button> </div> </div> </asp:panel> <asp:button id="button1" runat="server" cssclass="btn btn-info btn-small" text="view" commandname="view" /> </td> </tr> </itemtemplate> <itemstyle width="160px" /> </asp:templatefield> </columns> </asp:gridview>
i not sure why cannot hide panel contains other html , button control when use findcontrol.
i have other findcontrols work fine, 1 gives me error cannot find panel1.
i using panel hide code inside it.
this has nothing panel.
make sure have data row , not header or something.
if e.row.rowtype = datacontrolrowtype.datarow ... end if
Comments
Post a Comment