I am trying to enclose SPGridView inside an UpdatePanel control in a user control page (.ascx), however whenever I click on the paging links for the grid, it still postbacks instead of partial page rendering. Also, this is not the first time I have used ajax in my project. I have taken the same code that has worked on other controls and applied them to the SPGridvew with no success. Below is a sample of the user control page in question with my override childcontrols. Any thoughts? -
protected override void CreateChildControls()
-
{
-
// Register the AJAX ScriptManager
-
ScriptManager ajaxScriptManager = ScriptManager.GetCurrent(this.Page);
-
-
if (ajaxScriptManager == null)
-
{
-
ajaxScriptManager = new ScriptManager();
-
ajaxScriptManager.ID = "AJAXScriptManager";
-
ajaxScriptManager.EnablePartialRendering = true;
-
this.Controls.Add(ajaxScriptManager);
-
}
-
-
EnsureAJAXUpdatePanelCompatibility();
-
-
ajaxUpdatePanel = new UpdatePanel();
-
ajaxUpdatePanel.ID = "AJAXUpdatePanel";
-
ajaxUpdatePanel.ChildrenAsTriggers = true;
-
ajaxUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
-
this.Controls.Add(ajaxUpdatePanel);
-
-
currentSite = SPContext.Current.Web;
-
-
using (ListCaml listCaml = new ListCaml(currentSite))
-
{
-
searchID = ((SearchLibraryResultsPage)this.Page).searchID;
-
searchResultInfo = SearchProcessController.GetSearchResultInfo(searchID);
-
-
using (Fields fields = new Fields())
-
{
-
searchResultsInfoArray = fields.CreateStringValueArray(searchResultInfo);
-
}
-
-
elapsedTime = Convert.ToDouble(searchResultsInfoArray[0]);
-
setNumber = Convert.ToInt16(searchResultsInfoArray[1]);
-
rowStart = Convert.ToInt16(searchResultsInfoArray[2]);
-
rowCount = Convert.ToInt16(searchResultsInfoArray[3]);
-
isNextSet = Convert.ToBoolean(searchResultsInfoArray[4]);
-
sortManagedProperty = searchResultsInfoArray[5];
-
sortDirection = searchResultsInfoArray[6];
-
-
searchResultsDT = (DataTable)Cache["SearchResults_" + searchID.ToString()];
-
searchCriteriaDT = (DataTable)Cache["SearchCriteria_" + searchID.ToString()];
-
-
gridView = new SPGridView();
-
searchResultsDV = new DataView(searchResultsDT);
-
gridView.DataSource = searchResultsDV;
-
-
//CreateViewColumnMenu();
-
-
searchCriteria = new StringBuilder();
-
-
foreach (DataRow libraryFieldsDR in searchCriteriaDT.Rows)
-
{
-
if (libraryFieldsDR["Value"].ToString() != string.Empty)
-
{
-
CreateSearchCriteriaList(libraryFieldsDR["Column_Name"].ToString(), libraryFieldsDR["Literal_Operator"].ToString(),
-
libraryFieldsDR["Data_Type"].ToString(),libraryFieldsDR["Value"].ToString());
-
}
-
-
if (libraryFieldsDR["Column_Name"].ToString() != "Path")
-
{
-
SPBoundField boundField = new SPBoundField();
-
boundField.HeaderText = libraryFieldsDR["Column_Name"].ToString();
-
boundField.DataField = libraryFieldsDR["Managed_Property"].ToString();
-
boundField.SortExpression = libraryFieldsDR["Managed_Property"].ToString();
-
gridView.Columns.Add(boundField);
-
}
-
}
-
gridView.AutoGenerateColumns = false;
-
gridView.AllowSorting = true;
-
gridView.AllowPaging = true;
-
gridView.PagerSettings.Position = PagerPosition.Top;
-
gridView.PagerSettings.Mode = PagerButtons.NumericFirstLast;
-
gridView.PagerSettings.PageButtonCount = 5;
-
gridView.PageSize = listCaml.GetSearchResultLimits(Convert.ToInt16(Session["Current_LibraryID"]), SharePointSearch.resultsPerPage);
-
gridView.Sorting += new GridViewSortEventHandler(gridView_Sorting);
-
gridView.PageIndexChanging += new GridViewPageEventHandler(gridView_PageIndexChanging);
-
-
-
ajaxUpdatePanel.ContentTemplateContainer.Controls.Add(gridView);
-
//PagerTemplate must be added after you added the control, but before you bind your data
-
gridView.PagerTemplate = null;
-
gridView.DataBind();
-
-
//AddResultsInformation();
-
-
//Preserves the sorting when page is reload
-
if ((!Page.IsPostBack) && (sortManagedProperty != string.Empty) && (sortDirection != string.Empty))
-
{
-
ViewState["SortExpression"] = sortManagedProperty;
-
ViewState["SortDirection"] = sortDirection;
-
AddSortColumnArrows(gridView.HeaderRow,sortManagedProperty, sortDirection);
-
gridView.DataBind();
-
}
-
}
-
}
-
1 2715
Well after many of hours messing with this, I decided to just double check that the UpdatePanel was even working. So I added a TextBox and a Button with an EventHandler that would clear the text out of the TextBox. To my amazement, when I added those two controls the SPGridView started working... I did a few more experiments and soon I discovered that by just having a TextBox control visible on the screen would allow the SPGridView to work with the UpdatePanel. Take it off the page and SPGridView is back to full postbacks. I am now completely mystified on what’s going on, anybody have an idea?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Yarco |
last post by:
I want to use "Ajax" to create my web for hobby.
But i don't know whether "Ajax" is mature...
And what about with php? Someone have experience on it?
....
|
by: bobzimuta |
last post by:
I'm creating a simple AJAX library. It's an object that will return an
array containing the response text or xml. I'm trying to find a way to
assign the response as a property of the object, but from within an
inline function.
Within the AJAX object:
this.xmlhttp = new XMLHttpRequest();
this.response = ''; //to contain the response text OR xml
var that = this; //since we cannot reference this within the
|
by: melledge |
last post by:
Ajax Developers' Day added to XTech 2006 agenda
XTech 2006 - 17-19 May - Hotel Grand Krasnopolsky - Amsterdam, The
Netherlands
|
by: melledge |
last post by:
Ajax Developers' Day to Kick Off XTech 2006 Conference
Industry experts offer insight into next generation of the Web
ALEXANDRIA, VIRGINIA, USA - April 25, 2006 - In response to the
rapidly developing world of Ajax user interfaces on the browser,
IDEAlliance (www.idealliance.org) announced today that its annual XTech
Conference will kick off on May 16 with Ajax Developers' Day. XTech
2006 (www.xtech-conference.org), to be held May...
|
by: www.web20developers.com |
last post by:
http://www.web20developers.com
http://www.web20developers.com/index.php?option=com_content&task=view...
Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell
AJAX - microlink pattern tutorial : A microlink is a link that opens up
| |
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= |
last post by:
controlsPlease could some of you here post some of your live examples of AJAX
(esp drag panels, collapsable panels, and popup menu.)
(It's one thing to talk about how great something is, but it's another to
really see how great something is.)
Thanks
--
Share The Knowledge. I need all the help I can get and so do you!
|
by: soni2926 |
last post by:
hi,
does anyone know of any good books on ajax and asp.net, one that
teaches ajax itself before jumping in atlas? I wanted to get an
understanding of ajax and how to use it, most books i've seen on .net
and ajax seem to jump into atlas right away, does anyone know of any
that teach ajax itself and then later get into atlas?
|
by: shaunwo |
last post by:
I'm an AJAX / DOM Novice (at best) and trying to figure out how to write the value to a couple input fields. I don't remember exactly where I got the ajax.js file I'm using from (went to the website that I see in the comments, but no luck there), but what I already have works GREAT to populate the options in a select box. Now I'm trying to take that same code and get it to write the value to a couple input boxes.
Here's a link to my ajax...
|
by: =?Utf-8?B?R2VyaGFyZA==?= |
last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit
(using .net version 3.5) is closed before the Ajax enable controls complete
loading, then IE locks up. Does it in both IE7 and IE8. There is no issue
when the controls are allowed to complete loading.
Can you please tell me the best practice that handles this?
Thanks.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |