Showing posts with label sorting. Show all posts
Showing posts with label sorting. Show all posts

Wednesday, March 21, 2012

A push in the right direction please?

I would like to have two listboxes filled with sorting criteria, and based upon the two selections in the listbox utilize some ajax functionality to update a gridview on the same page on the fly without any postback. The gridview holds a bunch of printer information with multiple manufacturers. Based upon the manufacturer selected in the list box will cause the gridview sort out the matching values and display the gridview contents without the need for a postback. Keep in mind though that I will be using two listboxes which will determine two search criteria the gridview will utilize. Is it possible to have this done with the current ajax control toolkit? If so does anyone know of any good articles to read that will "push me in the right direction"? Thanks for the help!.

http://msdn2.microsoft.com/en-us/library/aa581792.aspx

Really, the only thing you'd need the AJAX toolkit for would be to wrap the two list boxes and the gridview in an update panel (or just wrap the gridview in an update panel and set the list boxes as triggers) to hide the postback.

A problom about updatepanel

If I put a gridview into the panel, the gridview's paging and sorting become useless.

Why? Is there a good point to instead ?

useless? what exactly are you asking? is something not working?
Hi,
It is not a problem about the update panel. You have to write a code for it.
For example:
<cc1:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridViewID="GridView1" runat="server" Style="z-index: 102; ">
</asp:GridView>
</ContentTemplate>
<Triggers>
<cc1:ControlEventTrigger ControlID="GridView1"EventName="PageIndexChanging" />
</Triggers>
</cc1:UpdatePanel
Bind a datagrid with a suitable data in page behind code.
Add a code in code behind like this.
Protected Sub GridView1_PageIndexChanging(ByValsender As Object, ByVal e AsSystem.Web.UI.WebControls.GridViewPageEventArgs) HandlesGridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
End Sub
You wil get it work.
Enjoy programming.
Smile
Hi,
Make sure another thing ..
Check that EnablePartialRendering=true property in script manager.
If you didnt add this property to script manager everything works as usual with postback.
Regards,
Enjoy programming,
Muthu Kumaran.D
(Unknown is Ocean)
This is incorrect. If the gridview is inside the update panel, why do you need the trigger? I've set mine up normally (with full postbacks), then added 4 lines, open and close <atlas:UpdatePanel> and <ContentTemplate> and that was all it took.
hi rchern13,
I agree that I am wrong. But I should inform you that this method also working correctly.