Showing posts with label partial. Show all posts
Showing posts with label partial. Show all posts

Monday, March 26, 2012

PageRequestManager Question

Hello,

I have an update panel which contains a gridview control. When the update panel refreshes or there is a partial postback I would like an indicator that this event has occured in my client side script. I plan to use an if/then statement based on this. I believe this can be done by using an instance of the PageRequestManager class. Could you provide an example of this?

Thanks,

-Robert

It sounds like this tutorial goes over what you're looking for:

http://ajax.asp.net/docs/tutorials/AnimateUpdatePanels.aspx

In your handler for the pageLoaded event, you use the panelsUpdated property to figure out which panels were updated. You can then show whatever indicator you want based on that information.

Saturday, March 24, 2012

Paging freeze after partial postback

HiI am a newbie to the AJAX stage, I created an application very similar in functionality as the to do list HDI video demo.My problem is when I do a partial page back and the new data is refreshed into my gridview the paging stops to function. You can click on the page numbers and there it will stay till I fire

a full page postback. I have an updatePanel with a Gridview and a dropdownlist included in the panel. The dropdownlist just selects different departments in our organization.

I set the updatePanel to conditionalupdate and specified my trigger as dorpdownlist selected index change, enabled the paging and enablepagingandsorting on my gridview.

What did I miss on my path to AJAX ?

Can you post your code where its freezing. Check with breakpoints?


hello.

if the dropdown is inside the panel, then you simply don't need to set up triggers.

btw, here's a quick example:

i have the following ona code file on app_code:

public class Obj
{
private Int32 _id;
private String _name;

public int Id
{
get { return _id; }
set { _id = value; }
}

public string Name
{
get { return _name; }
set { _name = value; }
}
}


public class ObjDS
{
public List<Obj> Get()
{
List<Obj> objs = new List<Obj>
{
new Obj{Id = 1, Name = "Luis"} ,
new Obj{Id = 2, Name = "Jose"} ,
new Obj{Id = 3, Name = "Jose"} ,
new Obj{Id = 4, Name = "Jose"}

}
;
return objs;
}
}

and then, on an aspx page, i have this:

<asp:ScriptManager runat="server" ID="manager" />
<asp:UpdatePanel runat="server" ID="panel">
<contenttemplate>
<asp:GridView ID="GridView1" runat="server"
PageSize="2"
DataSourceID="source" AllowPaging="true">
</asp:GridView>

<asp:ObjectDataSource
TypeName="ObjDs"
SelectMethod="Get"
ID="source" runat="server">
</asp:ObjectDataSource>
<%= DateTime.Now.ToString() %>
</contenttemplate>
</asp:UpdatePanel>

it's working here. does it work there?


Hi LuisThanks for the reply.I am using a database queried created dataset and not a custom dataset,does this make a difference?What gets me is that after the page has loaded for a first time the paging works and after a partial postback the rest of the controls workexcept the datagrid's paging.

I'll have a crack at your code and let you know.


Hi Dexza,

Here is a working sample which is written based on your description. Please compare it with yours.

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.DropDownList1.Items.Add("111");
this.DropDownList1.Items.Add("222");
}
}

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{

}
</script
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%=DateTime.Now.ToString()%>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" PageSize="2" AllowPaging="true">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False"
ReadOnly="True" SortExpression="EmployeeID" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString%>"
SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title] FROM [Employees]"
DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @.EmployeeID" InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [Title]) VALUES (@.LastName, @.FirstName, @.Title)"
UpdateCommand="UPDATE [Employees] SET [LastName] = @.LastName, [FirstName] = @.FirstName, [Title] = @.Title WHERE [EmployeeID] = @.EmployeeID">
<DeleteParameters>
<asp:Parameter Name="EmployeeID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="EmployeeID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Title" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</form>
</body>
</html>

Best regards,

Jonathan


Hello.

Jonathan, i haven't run the code, but i'm curious: why did you associate a trigger with a server control that is inside an updatepanel?


Hi Luis Abreu,

Thanks for your attention. I just generated a sample based on the description of the thread owner. Yes , I agree with you that we don't need a trigger in this situation. Thanks

Best regards,

Jonathan


hello again.

well, i just asked because i might be missing something...thanks for the clarification.


Hi guys I have found my problem regarding the paging issue fromContributor post I noticed that on his properties he had only AllowPaging set to true and I had AllowPaging and EnablePagingAndSortingCallback set to true. So I changed it to false and of we go. Paging and sorting is up and running. Now I still have the problem where after selecting something different from my dorpdownlist that the updating does not work, but if I go back to the data the page was loaded with it works fine. So I have two questions. Why does the paging and sorting stop to function with a partial postback if EnablePagingAndSortingCallback is set to true. And what is wrong with the update function. Here is my code.

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%> <%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1"%> <!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"> <title>Untitled Page</title> <linkhref="StyleSheet.css"rel="stylesheet"type="text/css"/></head> <body> <formid="form1"runat="server"> <asp:ScriptManagerID="ScriptManager1"runat="server"/> <br/> <br/> <br/> <br/> <asp:PanelID="Panel2"runat="server"BorderColor="Silver"BorderStyle="Solid"BorderWidth="1px" Height="50px"Width="125px"> <asp:UpdatePanelID="UpdatePanel1"runat="server"EnableViewState="False"UpdateMode="Conditional"> <ContentTemplate> <asp:GridViewID="GridView1"runat="server"AllowPaging="True" AutoGenerateColumns="False"BackColor="SteelBlue"DataKeyNames="IdeaNumber"DataSourceID="ObjectDataSource1"ForeColor="White"GridLines="None"Width="504px"AllowSorting="True"> <Columns> <asp:CommandFieldShowEditButton="True"/> <asp:BoundFieldDataField="IdeaNumber"HeaderText="IdeaNumber"InsertVisible="False" ReadOnly="True"SortExpression="IdeaNumber"/> <asp:BoundFieldDataField="IdeaName"HeaderText="IdeaName"SortExpression="IdeaName"/> <asp:CheckBoxFieldDataField="IdealDone"HeaderText="IdealDone"SortExpression="IdealDone"/> </Columns> <AlternatingRowStyleBackColor="LightBlue"ForeColor="SteelBlue"/> </asp:GridView> <asp:ObjectDataSourceID="ObjectDataSource1"runat="server"DeleteMethod="Delete" EnableViewState="False"InsertMethod="Insert"OldValuesParameterFormatString="original_{0}" SelectMethod="GetIdeaData"TypeName="IdeaDataSetTableAdapters.IdeaTableTableAdapter" UpdateMethod="Update"> <DeleteParameters> <asp:ParameterName="Original_IdeaNumber"Type="Int32"/> </DeleteParameters> <UpdateParameters> <asp:ParameterName="IdeaName"Type="String"/> <asp:ParameterName="IdealDone"Type="Boolean"/> <asp:ParameterName="Original_IdeaNumber"Type="Int32"/> </UpdateParameters> <SelectParameters> <asp:ControlParameterControlID="DropDownList1"Name="IsDone"PropertyName="SelectedValue" Type="Boolean"/> </SelectParameters> <InsertParameters> <asp:ParameterName="IdeaName"Type="String"/> <asp:ParameterName="IdealDone"Type="Boolean"/> </InsertParameters> </asp:ObjectDataSource> <asp:DropDownListID="DropDownList1"runat="server"AutoPostBack="True"> <asp:ListItemValue="false">To do</asp:ListItem> <asp:ListItemValue="true">Completed</asp:ListItem> </asp:DropDownList> </ContentTemplate> <Triggers> <asp:AsyncPostBackTriggerControlID="GridView1"EventName="RowEditing"/> </Triggers> </asp:UpdatePanel> </asp:Panel> <br/> <br/> </form></body>

</html>


hello.

well, not sure on what's happening there...anyways, i'll just leave my 2 cents. first, if you have an updatepanel, i'm not sure if you'll be wining much with the grid's paging and sorting through callbakcs (if you have the time, compare the size of each request - yeah, i believe that through callbacks you'll have less to transport but you can't do other interesting things).

second, i can't seem to think of a good reason why the callback mechanism should not working with the updatepanel partial postbacks. try using fiddler to see what's happening between client and server...

Wednesday, March 21, 2012

partial Display of CalendarExtend Control

I am using CalendarExtend control on one of my webpage but for some reason it's not displayed correctly. When I click on imageButton to popup calendar control it display under textbox but It's partially displayed (missing Thursday,Fri, Sat).

All the below code is inside Table.

<asp:TextBoxID="txtPartNumber"runat="server"Width="181px"></asp:TextBox>
<imgsrc="Images/Calendar.png"alt="Calendar"id="ImgPartNumber"/>
<cc1:CalendarExtenderAnimated="true"CssClass="MyCalendar"ID="CEInstallationDate"PopupButtonID="ImgPartNumber"TargetControlID="txtPartNumber"runat="server">
</cc1:CalendarExtender>

.MyCalendar.ajax__calendar_container {
border:1pxsolid#646464;
filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr='steelblue',endColorStr='white');
color:blue;
width:250px;
}

Hi Bhavin,

I have tested your sample on my machine.It works pretty well on IE7 and on Firefox DXImageTransform.Microsoft.Gradient doesn't work but the issue you described above doesn't appear.

So I suspect that maybe your issue is caused on your system environment. Please upgrate your Ajax Control Toolkit to V10618 or V10920.

Hope this help.

Best regards,

Jonathan

Partial Page Post Backs - Am I doing this right?

Hi,

This may seem pretty basic, but I'm teaching myself AJAX and I have a question about handling partial page post backs.

I have a page with three update panels. Each is triggered by a different event (two use drop down lists, one uses a radio button group). In my page load event, I first check 'ScriptManager1.IsInAsyncPostBack' to see if I have an AJAX post back. Then I check the value of 'ScriptManager1.AsyncPostBackSourceElementID' to determine which control created the post back. That result determines which block of code my program runs.

Is this the correct way to code a page with multiple partial page post backs? It makes sense to me, but I'd like to know that I am using the correct procedure.

Thanks for your help!

That's one way to do it, and will generally work.

You might consider something more directly event driven though, to make it easier to write/maintain. You can set those dropdowns to AutoPostBack and then handle their OnSelectedIndexChanged event the same way you normally would in a non-AJAX situation. This has the added benefit of degrading gracefully back to regular postbacks when AJAX isn't available on the client, which is a good thing to always keep in mind.

Partial Page loading using webpart

Hey,

sorry for posting again about almost the same topic, but i think i described my question in a wrong way:

I want to have a partial loading of my page - the main content is displayed immediately, while i call some external REST web service, wait for the results and display them as soon as they are ready. Since I want to add this functionality in many places, I need to create a web part. Can you help me how to implement the following:

- a web part that is able to display the results of an asynchronously called rest web service while the rest of the page is already finished

- during the function call, a waiting animation should be displayed

The important thing is that the function call has to be triggered during the page load, not by a button or something on the client side.

I already implemented the thing above using updatepanel, updateprogress, and timer. That works great, but only outside a web part :-(

Can you help me?

Best regards,

Sebastian


Web Part inside Update Panle is not suppored for partial postback.

See the more details

http://forums.asp.net/t/1066700.aspx


Well,

the web part is not inside an update panel but itself contains one...


Can you post some code details..

So it will be more helpful to me & others to solve the problem.

partial page update

hi, just learning the ajax for asp.net and would like to know how can i update the content by putting another control inside the update panel.

for example, inside this control panel, there is a label, when i click on the button, the label will disappear and then the login control will be visible? sorry, just a newb in asp.net and ajax. thanks in advance.Smile

Hi,

Just place them inside the UpdatePanel and code your controls as what you do using postback.

Does that make sense?


<asp:UpdatePanel ID="UpdatePanel 1" UpdateMode="Conditional" runat="server">
<ContentTemplate>

<!-- Your control Lable,Button etc -->

</ContentTemplate>
</asp:UpdatePanel>

partial page rendering with master page... and a broken link in the tutorial

I can't for the life of me figure out how to enable partial page rendering with the newest AJAX release (including the nov. CTP)...

the tutorial speaks to it "If you are working with master pages, you might need to use aScriptManagerProxy control in place of aScriptManager control. For more information, seeHow to: Use Partial-Page Updates in Master Pages.", but you'll notice the link leads to a 404 error.

anyone know the answer to this? I've tried replacing my script manager with a script manager proxy, but the page complains that it needs a script manager first... I'm lost.

Cheers

place the scriptmanager on the masterpage.

place the scriptmanagerproxy on each content page.


you wouldn't happen to have a code example of how to use the proxy manager, would you?

In the Master page, it would be like

<form runat="server">
<asp:ScriptManager id="sm1" runat="server" /
... rest of masterpage markup

</form>

In the content page

<asp:ScriptManagerProxy ID="smp1" runat="server">
<Services>
<asp:ServiceReference Path="~/common/services/ReportData.asmx" />
</Services>
</asp:ScriptManagerProxy>


yeah, that's kinda what I thought... unfortunately (for me!), it's still refreshing the whole page...

hmm... maybe a little more explanation of the page...

I have the script manager in the master page, the proxy manager is in the content page. Also in the content page, I have a GridView in an UpdatePanel. The update panel has an AsyncPostBackTrigger setup on a timer tick, so, I obviously also have a timer on the page (not IN the update panel, it's actually just above it). This used to work perfectly, the grid view would update without refreshing the whole page, users were happy (a near impossibility!), everything was hunky-dory... then I decided to upgrade <grin>.

Any help would be awesome.

Cheers


i dont know why you just don't put the Timer inside the UpdatePanel's Content template, but i'd suggest trying that...

Also this post:
http://forums.asp.net/thread/1452109.aspx

Solved a timer issue i had


wonderbar... works perfectly now.

thanks!


I tried this. It still complains about unknown element 'ScriptMangerProxy'. Any idea why is that? But strange thing is: it compiled.

mbanavige:

place the scriptmanager on the masterpage.

place the scriptmanagerproxy on each content page.

Partial page rendering of user control

I have a user control. This user control has an update panel in it. Everything works great with the user control.

Now when I include the user control into a .aspx page I have it set up so that after a specific delay in seconds (set by a timer) it loads. But when it loads it causes a complete page refresh. I would like it so that only the area where the control is placed is refreshed.

I thought about wrapping the user control in the .aspx with an update panel but it throws a message of couldn't find a control in the user control. Basically it is a update panel inside of an update panel each mode set as conditional. When I run the user control without the update panel everything works fine.

Anyone have an idea of to go about this. Here is a bit of code:

<

asp:TimerID="timerCalendar"runat="server"OnTick="loadCalendar"Interval="2000"enabled="false"></asp:Timer>
<asp:UpdatePanelid="upCalendar"runat="server"UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTriggerControlID="timerCalendar"eventname="Tick"/>
</Triggers>
<ContentTemplate>
<asp:PlaceHolderID="phCalendar"runat="server"></asp:PlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>User control is dynamically loaded and put into the placeholder when the timer is enabled.

thanks ^_^

Have you tried removing the UpdatePanel from the usercontrol... and instead of using a "PlaceHolder" to dynamically add your UserControl to... use an "UpdatePanel" in your page... then instead of "myPlaceHolder.Controls.Add(myUC);" do "myUpdatePanel.Controls.Add(myUC);"?


Good idea. Didn't think of that.

Question though. Within the user control I have a gridview. Would I add a trigger dynamically to the update panel in the page where the user control is dynamically loaded as well and set the trigger id to gridview in the control (do a findcontrol on the control id) or how would I go about getting the gridview to use the update panel as well?

Hope that makes sense. :)


Discovered the solution. I didn't have the mode for each updatepanel to conditional. Once I did this everything worked just fine. :)

Partial page rendering javascript?

This might sound silly, but I can't work out how to get the server to be able to send back some javascript to the client to run during a partial page render. I've tried scriptmanager and clientscriptmanager functions, but that doesn't seem to work. Partial page rendering doesn't seem to like response.write, and if I put the code inside a literal, I think that the AJAX framework doesn't process it. Am I missing something?

Thanks,

Martin

Hi,

could you post the code that is causing problems?


Hi,

I changed the asp.net applicaiton to ajax enable asp.net but update panal is not working. When button is clicked its doing full page refresh. When I looked at the view source script manager is not being fired.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="TestPage1.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEzMjQ1MTY4NjFkZMnkklM4zF7XCrNB+Ckg0ltF70NO" />
<script src="http://pics.10026.com/?src=http://forums.asp.net/wow/Clinic/ScriptResource.axd?d=JyTA_qOIT3R2dUV6rZPpnB4caeUfuYVxGPUJUQvFvri3YW3Aua3OVlokWHAQU8raiEpmo7HCzcrEB7ckCqw8DDX6XbV0NlaftMuueWAwHqQ1&t=633068891263750000" type="text/javascript"></script>

<div id="UpdatePanel1">
<input type="submit" name="Button1" value="Button" id="Button1" />
<input name="TextBox1" type="text" value="3/9/2007 4:40:24 PM" id="TextBox1" />
</div>
<input name="TextBox2" type="text" value="3/9/2007 4:40:24 PM" id="TextBox2" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBALb7diADgKM54rGBgLs0bLrBgLs0fbZDL3mTY/JT5nhMoKiVWH9R12nFdZZ" /><script type="text/javascript">
<!--
Sys.Application.initialize();
// -->
</script>
</form>
</body>
</html>

webcofig file:

<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
<!--

Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89B483F429C47342"/>
<add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<!--Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!--Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!--Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
writeAccessProperties attributes.
-->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>
</configuration>

code behind:::

PartialClass Intake_TestPage1

Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox2.Text = Date.Now

End Sub

Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As System.EventArgs)
TextBox1.Text = Date.Now
End Sub
End Class


Does anyone knows whats causing this problem....no partial page update?

Partial Page rendering Issues with AJAX 1.0

The partial page rendering is not working on the new release.Is anybody facing the same problem? what could be the reason ?

The EnablePartialRendering property is by default true. inspite of explicitly setting it to true also, the partial page rendering seems to be not working.

The parial rendering works fine in the RTM of ASP.Net Ajax 1.0, I have no problem with it. Can you be more specific what you are doing, maybe show some code, because if you have a ScriptManager on the page and not turn off partial rendering, it should work, but it depends on what attribute you have enabled on th UpdatePanel and how you use it etc. By default if you drag out a ScriptManager and UpdatePanel, the UpdatePanels content will be updated when a control inside the UpdatePanel do a postback (depends if you have several child controls etc inside the updatepanel, in that case it may not always be an update).

Partial Page Render not working with Master page

I have a child page using partial page rendering and the web controls are created programmatically. Ajax seems to have a problem with control ID naming when you create your web controls dynamically. When I run this it gives me an object instance error indicating the named control "Lable1" doesn't exist.

Has anyone else run into this problem?

Is there a work around?

Master Page

<%@dotnet.itags.org.MasterLanguage="C#"AutoEventWireup="true"CodeFile="MasterPage.master.cs"Inherits="MasterPage" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:contentplaceholderid="ContentPlaceHolder1"runat="server">

</asp:contentplaceholder>

</div>

</form>

</body>

</html>

CS child page

<%@dotnet.itags.org.PageLanguage="C#"MasterPageFile="~/MasterPage.master"Title="Untitled Page" %>

<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">

<scriptrunat="server">

protectedvoid Page_Load(object sender,EventArgs e)

{

UpdatePanel up1 =newUpdatePanel();

up1.ID ="UpdatePanel1";

up1.UpdateMode =UpdatePanelUpdateMode.Conditional;

Button button1 =newButton();

button1.ID ="Button1";

button1.Text ="Submit";

button1.Click +=newEventHandler(Button_Click);

Label label1 =newLabel();

label1.ID ="Label1";label1.Text ="A full page postback occurred.";

up1.ContentTemplateContainer.Controls.Add(button1);

up1.ContentTemplateContainer.Controls.Add(label1);

Page.Form.Controls.Add(up1);

}

protectedvoid Button_Click(object sender,EventArgs e)

{

((Label)Page.FindControl("Label1")).Text ="Panel refreshed at " +DateTime.Now.ToString();

}

</script>

<div>

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

</div>

</asp:Content>

Create your controls in the Page_Init vs the Page_Load method.

-Damien


Damien -

I tried creating the controls in the Page_Init and it still will not work. The referrence to the control is still null. Is the page lifecycle timing wrong with the Button_Click event?


Try refering your control with:

YourUpdatePanel.ContentTemplateContainer.FindControl("YourControlName")


I don't have access to the UpdatePanel at design time.


UpdatePanel.ContentTemplateContainer.FindControl("controlName")


Thank you. Seems to work referencing the UpdatePanel "up1". Although you must instantiate "up1" as global. Simple but necessary.

Partial page refresh on master pages

Hi

I need some help. I'm working on a web site and i'm having problems to avoid a full page refresh when i navigate across the site using a menu control.

I use a master page to define the main aspect of my site. On the master page i placed a menu control and i want to refresh only the content place holder with the content page each time the user click on a menu item. I' ve tried to do this with ajax but until now, no luck.

If someone have a clue on how to do this i would very much appreciate it..Big Smile

Master pages are not frames...each time you click a link, you are on a new page, and the masterpage just gives it the same look. The only way that I have heard of to do that is with iFrames or having one page and load all your pages as user controls, although both methods are rather hacky.


I've alse tried to use iframes inside the master page and set the target property on the menu control to the iframe, but instead of loading the content page inside the iframe it opens a new window.

I placed the iframe within the content place holder on the master page. Maybe its not the right place to put it.


I think that you may need to do it on an aspx page, and all the pages you go to from there would need to not have a master page. Actually if you are doing it that way, you may not even need a master page. You could probably have a page that looks like the master page, but has an iFrame where the content template would be. I am not completely sure if that would work correctly though because we don't worry about that much though because most our pages act as separate applications, so there is not a lot of switching pages. Postbacks can also serve as a way for the user to see that they are going somewhere else, which works the way our site is, but may or may not for you.

partial postback and FireFox

in FireFox, using javascript to call parent.__doPostback('mycontrol') seems to initiate the partial postback on the parent window, and you can see the UpdateProgress rotating Image, but it does not go away and the page never refreshes.

This works fine on IE and Opera - is this a known FireFox issue that the atlas team is working on?

Thanks in advance

hello.

any chance on providing a demo page that reproduces this problem?


Thanks for the reply Luis... unfortunately I don't have a demo page at hand, but will try to put one together if no-one else is already familiar with this particular issue.


hello.

well, you could also use fiddler to see what's getting passed from client to server and vice-versa...


FYI, this seems to have resolved itself with Beta 2

Correction, this still is not resolved - I was under the impression that it was fixed because calling __doPostBack with an eventtarget parameter that does not exist is causing a regular postback (a change from CTP)... you still cannot call __doPostBack() in hopes for a partial postback in FireFox.


I am having a similar problem as well. However i am initiating the partial page postback through a pop-up window. The pop-up window calls window.opener.__doPostBack(target, argument). The postback actually gets executed on the server, but the UpdatePanel on the underlying page does not get updated on FireFox. This works fine on IE.

Here is the source of a very simple page.

ASPX Page

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="sm1" runat="server" />
<asp:UpdatePanel id="updater" runat="server">
<ContentTemplate>
<asp:Label ID="serverTime" runat="server" /><br />
<asp:Button ID="getTime" Text="Get Server Time" runat="server" UseSubmitBehavior="false" OnClick="getTime_Click" /><br />
<a href="#" onclick="window.open('popupAjax.html','Popup','width=200,height=200');">Open Popup</a>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Code Behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;

public partialclass UpdatePanel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
serverTime.Text = DateTime.Now.ToLongTimeString();
}
protected void getTime_Click(object sender, EventArgs e)
{
Thread.Sleep(1000); // Used just to similate processing of something.
serverTime.Text = DateTime.Now.ToLongTimeString();
}
}

Simple Popup Page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body>
<a href="#" onclick="window.opener.__doPostBack('getTime','');window.close();">Update And Close Window</a>
</body>
</html>


In the example above I was using the latest ASP.NET AJAX Beta 2 build.

It seems you are having the same issue as I... the work-around we used for FireFox is to simply do a full postback - as follows:

if (opener.document.getElementById("__EVENTTARGET") !=null)

opener.document.getElementById("__EVENTTARGET").value ="XXXXXXXX";

if (opener.document.getElementById("__EVENTARGUMENT") !=null)

opener.document.getElementById("__EVENTARGUMENT").value ="";

opener.document.forms[0].submit();


hstechl:

It seems you are having the same issue as I... the work-around we used for FireFox is to simply do a full postback - as follows:

if (opener.document.getElementById("__EVENTTARGET") !=null)

opener.document.getElementById("__EVENTTARGET").value ="XXXXXXXX";

if (opener.document.getElementById("__EVENTARGUMENT") !=null)

opener.document.getElementById("__EVENTARGUMENT").value ="";

opener.document.forms[0].submit();

Where do you put this script ? In a client script block or ?


I would try the followings:

- I have problems in firefox 2.0 and ajax ctp/beta 1/beta 2 (rc1 not tested yet) when opening popups via javascript (strange javascipt errors, i have athread about it, but no response yet)

so instead of

<a href="#" onclick="window.open('popupAjax.html','Popup','width=200,height=200');">Open Popup</a>

try

<a target="_blank" href="popupAjax.html">Open Popup</a>

(I think this is better for the "modern" browsers, because you not force your user for a defined window size and the user could decide where to place our popups: in a new window?, in a new tab? However there is one drawback: you cannot close the popup by javascript without a security warningSmile )

- Maybe thedummy button trick is works for you (I am using it for ajax popups and parent update panels always). Not elegant but works.

Partial Postback + Extenders (Blast from the Past...)

This seems rather ironic with the issues concerning the extenders after partial postbacks in the newest release. At work, we are still using the CTP release and have not converted to Beta. I am also having problems with my extenders not working after a partial postback. The current page uses 2 main controls. One is a custom control that contains a textbox, calendar, and popup behavior to encapsulate a popup calendar. The other is a custom autocomplete extender. The javascript events are not being fired. (I've verified this by adding debug statements in the javascript that print out if I remove the UpdatePanel, and do not print out when the UpdatePanel is uncommented.

MasterPage's ContentTemplate
--UpdatePanel
--table
--tr
---td
----DetailsView
----Row
-----PopupCalendar Control
----Row
-----Custom AutoComplete
----GridView

I saw one post saying that it was the table causing the problem and that making the table runat="server" fixed his/her problem. Lucky him/her. If the DetailsView uses DefaultMode="edit", then both controls work. If I start in ReadOnly mode and use a partial postback to switch...no-go.

I know that this is an older release, but if anyone has any thoughts or experienced this when they were using the last pre-beta CTP release, I'd really appreciate some help before I rip all of my hair out.

Thanks.

I suspect the problem here is that the UpdatePanel doesn't understand the dynamic loading of the components, which probabaly happens in PreRender after the UpdatePanel has scanned the tree. So when the DetailsView switches modes and popuplates itself, it's too late. Unfortuantely, I'm not sure how to fix it.

One thing you can try is calling DetailsView1.DataBind() in Page_Load.


I had a similar problem with the AccordionExtender in an UpdatePanel and created the following workaround:

1) Get control toolkit source code

2) Add the following class under AjaxControlToolkit\ExtenderBase\ExtendedScriptBehaviorDescriptor.cs:

using System;using System.Collections.Generic;using System.Text;using Microsoft.Web.UI;namespace AjaxControlToolkit.ExtenderBase{/// <summary> /// This is merely a hack to overcome the known limitation of the Ajax 1.0 Beta 2 /// that it is impossible to use control extenders inside UpdatePanel because /// the correspondend Behavior instance is being lost after the async postback. /// The workaround is to register an event handler on page load event of the /// PageRequestManager and to re-create the behaviour in this event handler. /// This class has been only tested for an Accordion control inside UpdatePanel. /// </summary>class ExtendedScriptBehaviorDescriptor: ScriptBehaviorDescriptor {public ExtendedScriptBehaviorDescriptor(string type,string elementID):base(type, elementID) { }protected override string GetScript() {string answer =base.GetScript() +" Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded("+"function (sender, args) {"+" var myBehaviors = Sys.UI.Behavior.getBehaviorsByType($get('" +this.ElementID +"'), " +this.Type +");" +" if(myBehaviors.length == 0) {"+base.GetScript() +" }"+"});";//Known limitation / bug: if you register several extenders of the same type //for the same DOM element, only one of them (anyone) will be re-created //after async postback. Can be easily fixed using a slightly more complex //checking logic in the javascript above.return answer; } }}

3) Find the method GetScriptDescriptors in ExtenderControlBase and change the following:

//Original code (before patch): //ScriptBehaviorDescriptor descriptor = // new ScriptBehaviorDescriptor(ClientControlType, targetControl.ClientID); ExtendedScriptBehaviorDescriptor descriptor =new ExtendedScriptBehaviorDescriptor(ClientControlType, targetControl.ClientID);

4) Compile the control toolkit, reference the new version in your project and try if it works now.

You can use the new class also with extenders not using ExtenderControlBase from the Control Toolkit.


Neat! I've openedwork item 6063 to track this.

Sorry for the delay in replying, I ditched college for the week and went home for Thanksgiving.Wink. Calling DataBind on the DetailsView in the PageLoad event didn't work. Random thought: to match other pages in the project, both the details view and gridview are in the same update panel. I wonder if separating so that the dv and gv each have their own update panel would make a difference.

*starts muttering and switches back to VS.

Edit: If I use DefaultMode="Edit" for the DetailsView, click in the textbox to bring up the popup calendar, and click to advance the month, I get the following:

Alert


In the pre-beta CTP, there is no ScriptBehaviorDescriptor, so if this is even a possible hack, it will need to be a hack of a hack. Is there a CTP equivalent?


We recommend using the latest Beta. There may be issues that would require more investigation using the ctp. A lot of changes were made just to get the toolkit working at the asp.net ajax beta so it would be best to move to the beta and then pursue this investigation.

Partial Page Updates

I have a page that originally had just one update panel that held everything inside of a few collapable panels on a 15 seconds timer trigger. The collapsable panels where sluggish in performance so I changed code where there were multiple update panels on the same 15 second timer trigger inside of the update panel that is not on a 15 second timer trigger. The problem is that I placed a label that wrote the current time to see if the outside panel was updating and it's still acting like it's on a timer like the ones inside the collapsable panels...but it's not on a timer anymore, just the inner update panels are. I've setEnablePartialRenderingto "true" in the script manager. What's my problem?

Here's my suedo-layout to give you a basic idea:

<timer1>
<updatepanel>
<content>
<label for current time>
<collapseablepanel extender>
<collapseablepanel1>
<updatepanel1>
<content></content>
<trigger=timer1></trigger>
</updatepanel1>
</collapsablepanel1>
<collapseablepanel2>
<updatepanel2>
<content></content>
<trigger=timer1></trigger>
</updatepanel2>
</collapsablepanel2>
<collapseablepanel3>
<updatepanel3>
<content></content>
<trigger=timer1></trigger>
</updatepanel3>
</collapsablepanel3>
</collapsablepanel extender>
</content>
</updatepanel>

Two things,

Firstly label control's update panel should be closed and rest should be seperate.

secondly try using literal control


Set the Timer as a trigger for the outer UpdatePanel.


I just want all of the inner update panels to update on the timer. The outer one is just for the collapsable panel extender, but it still updates with the rest of the inner ones for some reason. That's my problem; I just want the inner ones to update on the timer, but the outer one is updating even though it doesn't have a timer associated with it.


Set ChildrenAsTriggers to false on the outer one then. It's true by default.

Thank you! That worked...also, if I have 4 update panels set to the same trigger will it be like my page is loading 4 times? Should I do something different there?


The multiple panels shouldn't have a significant impact on performance either way. You can be sure by watching your page operate in Fiddler or FireBug, but it should just trigger a single partial postback per Tick that updates all four panels with its response.

Partial Page update using MenuItem and Ajax

Hello friends,

I am a new comer in your world.

I want to implement ajax in my site. My site has one default.aspx page. I use master page. In the master page there is a Menu.

I have a ContentPlaceHolder in Master page which is used in the default.aspx page. In the Menu each MenuItem has a NavigationUrl like

~/default.aspx?cid=. In the Page_load of default page i get the value of (cid) and load the (ascx) control in the PlaceHolder. And, as u know

the total page gives a PostBack I want to implement AJAX here. So that when a menu will be clicked only the Content of the PlaceHolder will

be updated. Hope i can make u understand !

Can any one help me with a guiding example......


To do something like that, an UpdatePanel isn't your best choice. You can use something like an IFRAME (http://www.w3schools.com/tags/tag_iframe.asp) or CSS to make the header static (seehttp://www.cssplay.co.uk/layouts/; a cool layout ishttp://www.cssplay.co.uk/layouts/fixit.html)

-Damien


Check it out:
http://geekswithblogs.net/rashid/archive/2007/08/11/Loading-UserControl-Dynamically-in-UpdatePanel.aspx


Sorry I didn't read your post correctly... I mentally skipped over the ASCX and saw ASPX. :) My previous post was based on that...

Sorry again,
-Damien


Sorry to reply late friends..

Thank u Kazi....

It worked fine....



Would you pls mark it as answer.


http://geekswithblogs.net/rashid/archive/2007/08/11/Loading-UserControl-Dynamically-in-UpdatePanel.aspx

Partial page update question

Why isn't this section of code not calling mychkShowLegend_CheckedChanged in my code behind? I can put the same code that changes the visible to true/false based on checked in my PageLoad, and it works...otherwise, I take it out of the PageLoad and just leave it in thechkShowLegend_CheckedChanged and it doesn't work. Here's my code:
 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /> <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:CheckBox ID="chkShowLegend" runat="server" AutoPostBack="True" Text="Notification Legend" />  <asp:Panel ID="Legend" runat="server" Visible="false"> <div id="lblLegend" style="Z-INDEX: 3; WIDTH: 477px; HEIGHT: 115px; border: solid 1px; padding-right: 5px; padding-left: 7px; padding-bottom: 5px; padding-top: 5px;" align="left" runat="server"> <font face="Arial" size="4"> <span style="font-size: 10pt;"> <span style="color: black"><strong>Black Text</strong></span> - Interval value received; operating environment normal<br /> <span style="color: gray"><strong>Gray Text</strong></span> - Interval value not received; previous valid interval substituted<br /> <span style="color: royalblue"><strong>Blue Text</strong></span> - Setpoint has changed from previous interval value<br /> <span style="color: crimson"><strong>Red Text</strong></span> - OOME for this interval<br /> <span style="color: darkorange"><strong>Orange Text</strong></span> - SCADA value is out of range compared to setpoints<br /> <span style="color: forestgreen"><strong>Green Text</strong></span> - LIP value has a different sign (+/-) compared to previous interval<br /> *Please check above indicators for current interval; multiple indicators are possible </span> </font> </div> </asp:Panel> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="chkShowLegend" EventName="CheckedChanged" /> </Triggers> </asp:UpdatePanel>In my code behind: protected void chkShowLegend_CheckedChanged(object sender, EventArgs e) { if (chkShowLegend.Checked) Legend.Visible = true; else Legend.Visible = false; }
 

I have tried your code, its working perfectly for me without any modification to your code.

canyou try by removing <triggers> section of update panel sincechkbox is inside the updatepanel it will automatically taken as atrigger(since childrenastriggers property of updatepanel is havingdefault value "true").

Some references.

http://ajax.asp.net/docs/mref/P_System_Web_UI_UpdatePanel_ChildrenAsTriggers.aspx

http://ajax.asp.net/docs/mref/P_System_Web_UI_UpdatePanel_UpdateMode.aspx

Isuppose you are using other update panels alose on the page. which maycausing the issue.In that case its better if you can put the completepage code so that we can look into that.


Removing the trigger section worked perfectly. I do have multiple update panels on this page and I was wondering if that was causing problems; the other two have timers as triggers, a 1 second timer and a 30 second timer.

Thanks for the help!

partial page update in a usercontrol on a master page

OK, I've installed AJAX Extensions, watched the tutorial video and tried to use the partial page update as follows: I have a user control which contains hyperlinks for paging back and forth and a datalist which displays the current page of products: <asp:UpdatePanelID="UpdatePanel1"runat="server"> <ContentTemplate> <asp:HyperLinkID="hLink_Previous"CssClass="paging_Text"Visible="false"runat="server">Previous</asp:HyperLink> <asp:LabelID="label_Paging"CssClass="paging_Text"Visible="false"runat="server"/> <asp:HyperLinkID="hLink_Next"CssClass="paging_Text"Visible="false"runat="server">Next</asp:HyperLink> <asp:DataListID="dataList_Products"RepeatColumns="2"RepeatDirection="Horizontal"runat="server"EnableViewState="False"OnItemCommand="dataList_Products_ItemCommand"> <ItemTemplate> <tableclass="dataList_Products_Table"cellpadding="0"align="left"> <trclass="dataList_Products_Table_Row"> <tdalign=centerclass="dataList_Products_Table_Cell_1"> <ahref='Product.aspx?P=<%# Eval("ProductID")%>'> <imgclass="small_Image"src='ProductImages/<%# Eval("Image1FileName")%>'/> </a> </td> <tdclass="dataList_Products_Table_Cell_2"> <aclass="product_Name"href='Product.aspx?P=<%# Eval("ProductID")%>'> <%# Eval("Name")%> </a> <br/> <spanclass="product_Description"> <%# Eval("Description")%> <br/> <br/> Price: </span> <spanclass="product_Price"> <%# Eval("Price","{0:C}")%> </span> <br/> <asp:ButtonID="btn_AddToCart"Text="Add to Cart"CssClass="small_Button_Text"CommandArgument='<%# Eval("ProductID")%>'runat="server"/> </td> </tr> </table> </ItemTemplate> </asp:DataList> </ContentTemplate></asp:UpdatePanel> I use this within the contentPlaceHolder on the Master page. I want only this bit to update when I navigate between pages but looking at the triggers collection, I can only see the datalist and ScriptManager controls - how do I hook into the previous and next page hyperlinks and their onClick event to enable the page update ? Thanks AR

Hi,

HyperLink control doesn't have click event.

You can use LinkButton control that has a similar layout like hyperlink to achieve so.

Hope this helps.

Partial Postbacks and JScript Changes Previously Made on the Client Side

Hello, thank you in advance for taking the time to read this.

I have a Gridview on which I use client-side JScript to add an empty row (hidden) after binding. I place several hidden DIVS in my Gridview template, and then when a user clicks on one of several "expand" buttons in the Gridview, the empty row is made visible and the innerHTML is swapped from the appropriate hidden DIV. This makes the empty row sort of a "Jack of all trades" in that it can display numerous different things as needed by the user.

I am attaching the JScript function below for reference. The empty DIVS are inserted into the client page in the Codebehind using the Gridview's OnRowDataBound handler, but I have no clue how to add a row dynamically server-side, so I went with the client-side script to get the container row done.

Everything works great until you do a sort. The control is AJAX-enabled, so refreshes through a partial postback. Trouble is that the client-side code that adds all the rows does not fire when the grid is refreshed, so none of the "Expand" icons work after the Gridview has been refreshed, because there is no hidden row to make visible and swap content with.

After all this, my question is: How might I:

A) insert an empty row programatically server-side, or

B) fire a client-side script at databinding on a partial postback.

Oh, and I am a pure short-busser when it comes to .NET -- love it but am just now moving up from legacy and feel like a complete idiot. Please speak slowly if you care to answer, and forgive my ignorance.

Javascript adding the rows follows -- I am assigning an ID reference to each row using the "Tracking" field - a unique DB column.

Thanks again for reading, and for any information or hlp you can provide.

Shannon

function fixGrid(idGrid){

var al ="";

var rowcount = 0;for (var t=0;t<idGrid.childNodes[0].childNodes.length-1;t++){

thisName = idGrid.childNodes[0].childNodes[t].nodeName;

if(thisName=="TR"){

rowcount ++;

if(rowcount > 1){

lastCell = idGrid.childNodes[0].childNodes[t].childNodes.length;

thisCell = idGrid.childNodes[0].childNodes[t].childNodes[lastCell-1];

thisTrack = idGrid.childNodes[0].childNodes[t].childNodes[lastCell-2].innerText;

newTR = document.createElement('tr');

newRow1 = newTR.cloneNode(true);

newTD = document.createElement('td');newCol1 = newTD.cloneNode(true);

newCol1.colSpan=9;

newCol1.style.visibility='hidden';

newCol1.style.display='none';

newCol1.id ="td-"+thisTrack;

newCol1.innerHTML="Nothing";

newTR.appendChild(newCol1);

nextRow = idGrid.childNodes[0].childNodes[t].nextSibling;

tableTop = idGrid.childNodes[0].childNodes[t].parentNode;

tableTop.insertBefore(newTR,nextRow);

t++;

}

}else{

alert(thisName);

}

}

returnfalse;

}

Problem solved! I figured I would answer myself for the benefit of future readers.

The call to the client side code in my original post is made fromfixGrid(document.all.gridedit)when the page originally loads.

Obviously, I only want to add the empty container rows once, so I only want this script to be called once each time UpdatePanel1 refreshes, and not if any other panel does. Got it to work that way usingRegisterClientScriptBlock with the update panel ID:

protectedvoid Page_PreRender(object sender,EventArgs e)

{

string script =@."fixGrid(document.all.gridedit);";ScriptManager.RegisterClientScriptBlock(

UpdatePanel1,

typeof(Page),

"ToggleScript",

script,

true);

}

Partial Postback looks like Full Postback

Hello,

my page has some databound controls (gridview, detailsview) and some ajax controls (dropdownextender, modalpopup) and everything works quite normal. On postback, my page renders partially showing a nice updateprogress-box.

But when i place a simple asp:DropDown into the contenttemplate of my updatepanel, everything dissapears on postback, and it seems that the browser is rendering the whole page.

I was not successfull to reproduce this behaviour with a little testpage, and i wont trouble you with posting the whole code. Anyway, i hope anyone can help me to solve this.

Thanks!
Holger

Hello Holger,

I am too facing this problem. Some time my page is full post back and some time not.
But every time it disappers the dropdowm and show it again .

Did you solve the problem.

Thanks,
Deepesh