Showing posts with label building. Show all posts
Showing posts with label building. Show all posts

Monday, March 26, 2012

Ajax and WebParts

I am building a site that uses Web Parts and Ajax. In each Web Part I have a user control that uses Ajax to update itself. All the user controls use Ajax. Everything works well until, I close one of the web parts.When I do this and click on any of the controls to do an update, I get an error Sys.InvalidOperationException: Could not find UpdatePanel with ID <name of the panel that contained the web part that I closed>. If it is being updated dynamically then it must be inside another update panel.

Since all the controls use Ajax, how can i overcome the fact that the script is looking for the controls found in another Web Part.

1.Try to take a look at this useful blog about Dragging and dropping ASP.NET 2.0 Web Parts in Firefox and Safari with ASP.NET AJAX -http://blogs.neudesic.com/blogs/david_barkol/archive/2006/11/07/631.aspx
2.Try to read this thread - http://forums.asp.net/thread/1486784.aspx to get some ideas.
Here are some sample codes about using webParts in Ajax for your reference.
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="upPortal" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:WebPartManager ID="wpmPortal" runat="server">
</asp:WebPartManager>
<div class="wrapper">
<asp:CatalogZone ID="czPortal" runat="server">
</asp:CatalogZone>
</div>
<div class="wrapper">
<div id="wz1">
<asp:WebPartZone ID="WebPartZone2" runat="server" HeaderText="Column 1">
<ZoneTemplate>
<asp:Wizard ID="Wizard1" runat="server">
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2">
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
<%--<uc1:ThemeSelector ID="ThemeSelector1" runat="server" EnableTheming="True" />--%>
</ZoneTemplate>
</asp:WebPartZone>
</div>
<div id="wz2">
<asp:WebPartZone ID="WebPartZone3" runat="server" HeaderText="Column 2">
<ZoneTemplate>
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Black"
DayNameFormat="Shortest" Font-Names="Times New Roman" Font-Size="10pt" ForeColor="Black"
Height="220px" NextPrevFormat="FullMonth" TitleFormat="Month" Width="312px">
<SelectedDayStyle BackColor="#CC3333" ForeColor="White" />
<TodayDayStyle BackColor="#CCCC99" />
<SelectorStyle BackColor="#CCCCCC" Font-Bold="True" Font-Names="Verdana" Font-Size="8pt"
ForeColor="#333333" Width="1%" />
<DayStyle Width="14%" />
<OtherMonthDayStyle ForeColor="#999999" />
<NextPrevStyle Font-Size="8pt" ForeColor="White" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" ForeColor="#333333"
Height="10pt" />
<TitleStyle BackColor="Black" Font-Bold="True" Font-Size="13pt" ForeColor="White"
Height="14pt" Font-Names="Arial" />
</asp:Calendar>
</ZoneTemplate>
</asp:WebPartZone>
</div>
<div id="wz3">
<asp:WebPartZone ID="WebPartZone4" runat="server">
<ZoneTemplate>
<asp:Login ID="Login1" runat="server">
</asp:Login>
<asp:Login ID="Login2" runat="server">
</asp:Login>
</ZoneTemplate>
</asp:WebPartZone>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div
Can you send your website to my email:v-jicwan@.microsoft.com? I'd?like?to?test?it.

Hi Jasson,

Thanks for the information. I found the problem. Each of my user controls are inside an UpdatePanel tag. I had missed adding the attribute UpdateMode="Conditional". Once I added this attribute everything worked fine.

Thanks once again


Hi vinod,

I have the same problem. i have try your solution ...its working but it will referesh the page..

i want to work it without refereshing the page. is it possible.

waiting for your reply.

thanks in advance

vishnu


Hi vinod,

I have the same problem. i have try your solution ...its working but it will referesh the page..

i want to work it without refereshing the page. is it possible?.

please try to send sample code.

waiting for your reply.

thanks in advance

vishnu

Saturday, March 24, 2012

Ajax and Web custom Control

Hi all ,

Can any budy tell the approach for building a treeview web custom control using ajax

I cant getting the idea of rendring the tree view(HTML for Tree view ie using ajax)

Any help

Hi

Have you tried nested Datalists?

Thanks


No Jin

Nerver Header give some hint...

Another thing ,i start to build the tree using ul and li of html tag and rendering in the following manner

protected void BuildDivContainingTree(HtmlTextWriter output)
{

// Start building the HTML
output.Write("<div><ul><li>");
output.Write("<table><tr><td><IMG src='../../images/minus.gif'></td><td style='cursor:hand' onclick='onTextClicked(0,0);'>");
output.Write("<font color=red>");
output.Write(this.BaseNodeText + "</font></td></tr></table>");
output.Write("<div id='treeview_0'></div><div id='DivInPage'></div>");
output.Write("</li></ui>");

output.Write("<script>document.onreadystatechange=StartLoading('" + this.Type + "')</script>");

}

now i want to send a ajax cal for filling the node of the tree...

what should i do ?

as i created in the custom control i send a request to a aspx page and execute server function and place the out as response text as xml dox and render it in <li> inner text .

any suggestions

Ajax and UserControl from scratch

Hi all,

Iam building a web custom control from scratch ir no server control is used ..so how i implement ajax in this.

Example:i created a tree view using <ul><li> and when i clicked the node i call a javascript function for filling the data now where i write this function so that every call to this function is asynchronous

please help me out

Hi Spanco,

Partial Update Treeview is a complex and big project, so sorry we cannot provide a working sample as what you want to get.However, in my opnion, I think you may use Ajax + Div + WebService. Fortunately, I have found some urls related what you are concerning. Here they are:

1.http://www.codeproject.com/useritems/TreeViewAjax.asp

2.http://www.codeproject.com/Ajax/IntroAjaxASPNET.asp

3. http://ajaxaspects.blogspot.com/2006/01/tree-view-ajax-control.html The sample url:http://www.mathertel.de/AjaxEngine/S03_AJAXControls/TreeView.aspx . You can get the source code here and I hope that you can benefit from it. This sample is using Ajax + XML +WebService.

This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

I hope this help.

Best regards,

Jonathan

Wednesday, March 21, 2012

AJAX and Forms Authentication

Hi

I'm just starting to look at building AJAX functionality into our existing ASP.NET 2.0 web application. The web app is a portal-type application and uses Forms Authentication and the ASP.NET Membership/Profile providers to manager users.

I've followed through the tutorial videos and successfully AJAX-enabled a grid view on one of the pages which is filtered by a drop down list. I've also added an UpdateProgress tag which seems to work fine. The problem arises when a user changes the value in the drop down list after the forms authentication ticket has expired (which is currently set to 30 mins). Without AJAX, any change in the drop down list first redirects back to the login back, then posts back the original page to show the newly filtered gridview. Howvever, with AJAX, the first change to the list appears to simply redraw the existing grid data (regardless of what is selected), and subsequent changes result in the following browser/client error. The status code varies between 12030 and 12031 on different runs of the application.

--------
Windows Internet Explorer
--------
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12030
--------
OK
--------

I've searched around these forums, google, the online help etc. and it appears that you can use AJAX to control logins via forms authentication which implies that it must be possible to achieve what I'm after. However, so far it looks as though the AJAX callback is not respecting/using the forms authentication ticket.

Could anyone elighten me as to how AJAX callbacks work with forms authenticated sites and why this particular error message is occuring.

Best regards

Craig

Thanks for the link, I had a quick read through this yesterday, but there's been quite a few posts added in the last 12 hours or so.

I'm not sure it sounds exactly the same, but it could be related. As I said, I'm new to AJAX, so have only ever installed the RTM version and haven't tried anything earlier. My (limited) experience with update panels and logged-in users (via forms authetication) was that everything works fine until the authentication cookie expires - that's when the error occurs.

I'd be interested to know, from those who've used pre-RTM versions, what the expected behaviour should be. If an AJAX callback is made once the forms authentication cookie has expired, does the page redirect to the login page as with normal postbacks?

Thanks, Craig


Hi Craig,

This is an issue that has been introduced with the AJAX RTM. Several others of us are experiencing it but we haven't found a solution yet. We have a thread going about it at:

http://forums.asp.net/1553437/ShowThread.aspx#1553437


Yes, that would be the expected behavior.

The problem that I and others are seeing appears to be related to role caching though, not to cookie expiration.


Hi,

I had this exact same issue and found that it was related to the page validation and some hard coded text in a text box that contained "dangerous" characters. I had a textbox that had hard XML in the text area. Without the AJAX update panel, it would throw a warning error. With the AJAX update panel, it would throw the error you saw.

What I did for my testing purposes was switch the validaterequest to FALSE in the page declaration, and this fixed it. I know this is not ideal, but at least points to what the root cause is.

ValidateRequest="False"

Jason