c# - gridview.databind() not getting refreshed -
i have gridview :
<asp:templatefield> <headertemplate> <asp:label id="lblheaderdesc" runat="server" cssclass="highlights_header" text="description"> </asp:label> </headertemplate> <itemtemplate> <asp:label id="lbldesc" runat="server" cssclass="reportlabel" text='<%# bind("progdesc") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield> <headertemplate> <asp:label id="lblheaderstartdate" runat="server" cssclass="highlights_header" text="start date"> </asp:label> </headertemplate> <itemtemplate> <asp:label id="lblstartdate" runat="server" cssclass="reportlabel" text='<%# bind("startdate") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield> <headertemplate> <asp:label id="lblheaderenddate" runat="server" cssclass="highlights_header" text="end date"> </asp:label> </headertemplate> <itemtemplate> <asp:label id="lblenddate" runat="server" cssclass="reportlabel" text='<%# bind("enddate") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-cssclass="gridrow_amount"> <headertemplate> <asp:label id="lblheaderbudget" runat="server" cssclass="highlights_header" text="budget amount"> </asp:label> </headertemplate> <itemtemplate> <asp:label id="lblbudget" runat="server" cssclass="reportlabel" text='<%# bind("budget") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield> <headertemplate> <asp:label id="lblheaderstatus" runat="server" cssclass="highlights_header" text="status"> </asp:label> </headertemplate> <itemtemplate> <asp:label id="lblstatus" runat="server" cssclass="reportlabel" text='<%# bind("status") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-cssclass="gridrow_links"> <headertemplate> <asp:label id="lblheaderview" runat="server" cssclass="highlights_header" text="view details"> </asp:label> </headertemplate> <itemtemplate> <asp:linkbutton id="lnkprogname" runat="server" cssclass="reportlabel" text="open" onclick="lnkprogname_click"></asp:linkbutton> </itemtemplate> </asp:templatefield> </columns> <pagerstyle backcolor="#666666" forecolor="white" horizontalalign="center" /> <selectedrowstyle backcolor="#c5bbaf" font-bold="true" forecolor="#333333" /> <rowstyle horizontalalign="left" cssclass="gridrow_dsm" /> <headerstyle horizontalalign="center" cssclass="gridheaderrow" /> <alternatingrowstyle horizontalalign="left" cssclass="gridrowalt_dsm" /> </asp:gridview>
in code behind using
grvprogramsearch.datasource = somedatasource // populated grvprogramsearch.databind()
however, datasource populated gridview not getting populated.
write
grvprogramsearch.databind();
after,
grvprogramsearch.datasource = somedatasource;
Comments
Post a Comment