Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ajax

Reply
 
 
Victor Rodriguez
Guest
Posts: n/a
 
      08-28-2007
How can I make a Gridview to page up/down inside of:
<updatepanel>
<ContentTemplate>
<GridView></GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cmdGoFind" EventName="Click"
/>
<asp:AsyncPostBackTrigger ControlID="cmdRefresh"
EventName="Click" />
</Triggers>
</updatepanel>

Thanks,

Victor

 
Reply With Quote
 
 
 
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      08-29-2007
Hi Victor,

I'm not sure what do you mean of "page up/down" of the GridView. Do you
mean to scroll the GridView up/down or switch to prev/next page if the
GridView is paged?

Regards,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
 
Victor Rodriguez
Guest
Posts: n/a
 
      08-29-2007
I need to move from page 1 with 20 records to page 2 with 20 more records
using the paging tools of GridView.

Victor


""Walter Wang [MSFT]"" <(E-Mail Removed)> wrote in message
news:BDilv$(E-Mail Removed)...
> Hi Victor,
>
> I'm not sure what do you mean of "page up/down" of the GridView. Do you
> mean to scroll the GridView up/down or switch to prev/next page if the
> GridView is paged?
>
> Regards,
> Walter Wang ((E-Mail Removed), remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>


 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      08-30-2007
Thanks David for your input.

Hi Victor,

As David described, if you're using custom paging of GridView, then you
need to handle the PageIndexChanging event. However, if you're binding to a
DataSource control that supports paging by default (such as SqlDataSource),
then you don't need to handle it and it's already working.

To switch prev/next page without full postback, all you have to do is to
make those buttons a trigger of the UpdatePanel:


<asp:UpdatePanel ID="UpdatePanel1" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="au_lname"
HeaderText="au_lname" SortExpression="au_lname" />
<asp:BoundField DataField="au_fname"
HeaderText="au_fname" SortExpression="au_fname" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStringsubsConnectionString %>"
SelectCommand="SELECT [au_lname], [au_fname] FROM
[authors]"></asp:SqlDataSource>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1"
EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button2"
EventName="Click" />
</Triggers>
</asp:UpdatePanel>


protected void Button1_Click(object sender, EventArgs e)
{
if (GridView1.PageIndex > 0)
{
GridView1.PageIndex--;
}
}
protected void Button2_Click(object sender, EventArgs e)
{
if (GridView1.PageIndex < GridView1.PageCount - 1)
{
GridView1.PageIndex++;
}
}


I hope I haven't misunderstood your requirement here. Please feel free to
let me know if I did.


Regards,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Victor Rodriguez
Guest
Posts: n/a
 
      08-30-2007
I'm not using custom paging, I'm using what comes with GridView and whenever
I click to page it does not executes the command.

Victor


""Walter Wang [MSFT]"" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks David for your input.
>
> Hi Victor,
>
> As David described, if you're using custom paging of GridView, then you
> need to handle the PageIndexChanging event. However, if you're binding to
> a
> DataSource control that supports paging by default (such as
> SqlDataSource),
> then you don't need to handle it and it's already working.
>
> To switch prev/next page without full postback, all you have to do is to
> make those buttons a trigger of the UpdatePanel:
>
>
> <asp:UpdatePanel ID="UpdatePanel1" runat="server"
> UpdateMode="Conditional">
> <ContentTemplate>
> <asp:GridView ID="GridView1" runat="server"
> AllowPaging="True" AutoGenerateColumns="False"
> DataSourceID="SqlDataSource1">
> <Columns>
> <asp:BoundField DataField="au_lname"
> HeaderText="au_lname" SortExpression="au_lname" />
> <asp:BoundField DataField="au_fname"
> HeaderText="au_fname" SortExpression="au_fname" />
> </Columns>
> </asp:GridView>
> <asp:SqlDataSource ID="SqlDataSource1" runat="server"
> ConnectionString="<%$ ConnectionStringsubsConnectionString %>"
> SelectCommand="SELECT [au_lname], [au_fname] FROM
> [authors]"></asp:SqlDataSource>
> </ContentTemplate>
> <Triggers>
> <asp:AsyncPostBackTrigger ControlID="Button1"
> EventName="Click" />
> <asp:AsyncPostBackTrigger ControlID="Button2"
> EventName="Click" />
> </Triggers>
> </asp:UpdatePanel>
>
>
> protected void Button1_Click(object sender, EventArgs e)
> {
> if (GridView1.PageIndex > 0)
> {
> GridView1.PageIndex--;
> }
> }
> protected void Button2_Click(object sender, EventArgs e)
> {
> if (GridView1.PageIndex < GridView1.PageCount - 1)
> {
> GridView1.PageIndex++;
> }
> }
>
>
> I hope I haven't misunderstood your requirement here. Please feel free to
> let me know if I did.
>
>
> Regards,
> Walter Wang ((E-Mail Removed), remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>


 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      08-31-2007
Hi Victor,

Can you please post your code here? or you can send your complete to me via
email. This should work by default.

If you start from scratch to create a new WebForm to use my code, does it
work? Maybe this is related to your ajax configuration in web.config? Have
you checked that if other simple operations can work (such as putting a
Label and Button in UpdatePanel and changes Label.Text in Button.Click)?


Regards,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      09-05-2007
Hi Victor,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help. Thanks.


Regards,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An Ajax Dictionary... My first AJAX project... GreatDomainz@gmail.com HTML 20 03-31-2008 01:24 PM
Deploying ASP.NET AJAX-Enabled Web site to host without AJAX insta =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?= ASP .Net 2 02-21-2007 10:22 PM
AJAX IDE and AJAX TOOL--The Release of JoyiStar AJAX WebShop 3 Beta minnie Java 1 12-13-2006 06:29 AM
Ajax installed.. where are Ajax controls like popup in my VS toolbox ?? jobs ASP .Net 0 11-06-2006 01:23 AM
beginner AJAX questions (AJAX.net) darrel ASP .Net 5 04-28-2006 06:42 PM



Advertisments