asp.net - Paging for Gridview doesn't work correct -
i have search page. in list search results displayed.
when select page page numbers, search result disappeared , show list page refreshed. should do? tried onselectedindexchanged , onselectedindexchanging. , didn't work. thank you.
<asp:gridview id="gridview1" runat="server" allowpaging="true" autogeneratecolumns="false" cellpadding="4" datasourceid="ahsun" forecolor="#333333" gridlines="none" width="100%" datakeynames="sicil_no" onselectedindexchanged="linkbutton1_click" cssclass="icerik" o > <footerstyle backcolor="#507cd1" font-bold="true" forecolor="white" /> <columns> <asp:templatefield showheader="false"> <itemtemplate> <asp:linkbutton id="linkbutton1" runat="server" causesvalidation="false" commandname="select" cssclass="hover" text="seç"></asp:linkbutton> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="adı" sortexpression="adi"> <itemtemplate> <asp:linkbutton id="linkbutton3" runat="server" text='<%# bind("adi") %>' causesvalidation="false" commandname="select" cssclass="hover"></asp:linkbutton> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="soyadı" sortexpression="soyadi"> <itemtemplate> <asp:linkbutton id="linkbutton4" runat="server" text='<%# bind("soyadi") %>' causesvalidation="false" commandname="select" cssclass="hover"></asp:linkbutton> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="birimi" sortexpression="birimi"> <itemtemplate> <asp:linkbutton id="linkbutton5" runat="server" text='<%# bind("birimi") %>' causesvalidation="false" commandname="select" cssclass="hover"></asp:linkbutton> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="görevi" sortexpression="gorevi"> <itemtemplate> <asp:linkbutton id="linkbutton6" runat="server" text='<%# bind("gorevi") %>' causesvalidation="false" commandname="select" cssclass="hover"></asp:linkbutton> </itemtemplate> </asp:templatefield> </columns> <rowstyle backcolor="#eff3fb" horizontalalign="left" /> <editrowstyle backcolor="#2461bf" /> <selectedrowstyle backcolor="#d1ddf1" font-bold="true" forecolor="#333333" /> <pagerstyle backcolor="#2461bf" forecolor="white" horizontalalign="center" /> <headerstyle backcolor="#507cd1" font-bold="true" forecolor="white" horizontalalign="left" /> <alternatingrowstyle backcolor="white" /> </asp:gridview> <asp:sqldatasource id="ahsun" runat="server" connectionstring="<%$ connectionstrings:oraliveconnectionstring %>" providername="<%$ connectionstrings:oraliveconnectionstring.providername %>" selectcommand="select sicil_no, adi, soyadi, birimi ,gorevi,person_id xxah_hr_calisanlar sicil_no <> '01470' "></asp:sqldatasource> <br /> <asp:detailsview id="detailsview1" runat="server" cellpadding="4" datakeynames="sicil_no" datasourceid="sqldatasource1" forecolor="#333333" gridlines="none" height="50px" width="100%" captionalign="left" autogeneraterows="false" cssclass="icerik"> <footerstyle backcolor="#507cd1" font-bold="true" forecolor="white" /> <commandrowstyle backcolor="#d1ddf1" font-bold="true" /> <editrowstyle backcolor="#2461bf" /> <rowstyle backcolor="#eff3fb" horizontalalign="left" width="75%" /> <pagerstyle backcolor="#2461bf" forecolor="white" horizontalalign="center" /> <fieldheaderstyle backcolor="#dee8f5" font-bold="true" width="25%" /> <headerstyle backcolor="#507cd1" font-bold="true" forecolor="white" horizontalalign="left" width="25%" /> <alternatingrowstyle backcolor="white" /> <fields> <asp:boundfield datafield="adi" headertext="adı" sortexpression="adi" /> <asp:boundfield datafield="soyadi" headertext="soyadı" sortexpression="soyadi" /> <asp:boundfield datafield="birimi" headertext="birimi" sortexpression="birimi" /> <asp:boundfield datafield="gorevi" headertext="görevi" sortexpression="gorevi" /> </fields> </asp:detailsview> <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:oraliveconnectionstring %>" enablecaching="true" providername="<%$ connectionstrings:oraliveconnectionstring.providername %>" selectcommand="select c.* table c c.sicil_no=:sicil" > <selectparameters> <asp:controlparameter controlid="gridview1" name="sicil" propertyname="selectedvalue" /> </selectparameters> </asp:sqldatasource>
try enabling viewstate on datasource in aspx page adding enableviewstate="true" , viewstatemode="enabled"
Comments
Post a Comment