This is arun from Chennai, India.
I m doing a simple project in ASP.NET 4. My Gridview displays the data thru Dataset by clicking the Button1.
Everything works fine but whenever I click the second or next page, the data wont display. I need to click again the Button to display it.
Kindly review and let me know the error.
Thanks.
Default.aspx:
<asp:GridView ID=
"
GridView1"
runat=
"
server"
AllowPaging=
"
True"
EnableSortingAndPagingCallbacks=
"
True"
PageSize=
"
5"
OnPageIndexChanging=
"
gvpageindex"
>
Default.aspx.cs:
protected
void
gvpageindex(
object
sender, GridViewPageEventArgs e)
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataSource = ds1.GetData();
GridView1.DataBind();
protected
void
Button1_Click(
object
sender, EventArgs e)
GridView1.DataSource = ds1.GetData();
GridView1.DataBind();
can you please use
EnableSortingAndPagingCallbacks=
"
False"
<asp:gridview id=
"
GridView1"
runat=
"
server"
allowpaging=
"
True"
enablesortingandpagingcallbacks=
"
False"
xmlns:asp=
"
#unknown"
>
PageSize=
"
5"
OnPageIndexChanging=
"
gvpageindex"
>
</
asp:gridview
>
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.