Showing posts with label content. Show all posts
Showing posts with label content. Show all posts

Wednesday, March 28, 2012

Link Click refresh effect?

I got a master page and 2 content page.

the menu links are on the left content page.

How can i get refresh effect on the right content page when i click on the links on the left page?

http://code.google.com/webtoolkit/documentation/examples/kitchensink/demo.htmlHi,

one approach is to use theUpdatePaneltogether with theMultiViewcontrol.
Thanks very much,i got it.
sorry, can i get that kind of effect just click a link on the page without MultView?

eg. i put a link on the left content page. the right content page will refresh when i click the link?

Hi Joytony,

When you click the link, do you want to display a totally new page?? could you post the code you use for the links?

Greetings,

Dennis


Thanks Dennis,

This is the demo i did.

1 master page contain 2 links on it.
while i have 2 content page

~/Default2.aspx
~/Default3.aspx
How can i get the refresh effect in this model?
<%@. Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>"-//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">Untitled Page"server"> "form1" runat="server"> "scriptmanager1" EnablePartialRendering="true" runat="Server" /> "up1" runat="server">

"HyperLink1" runat="server" NavigateUrl="~/Default2.aspx">HyperLink "HyperLink2" runat="server" NavigateUrl="~/Default3.aspx">HyperLink

"ContentPlaceHolder1" runat="server">

"Progress" runat="server"> Loading...

sorry, put the code again.
<form id="form1" runat="server"> <atlas:ScriptManager ID="scriptmanager1" EnablePartialRendering="true" runat="Server" /> <atlas:UpdatePanel ID="up1" runat="server"> <ContentTemplate> <div> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default2.aspx">HyperLink</asp:HyperLink> <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/Default3.aspx">HyperLink</asp:HyperLink> <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton> <asp:LinkButton ID="LinkButton2" runat="server">LinkButton</asp:LinkButton> </div> <div> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </ContentTemplate> </atlas:UpdatePanel> <atlas:UpdateProgress ID="Progress" runat="server"> <ProgressTemplate> Loading... </ProgressTemplate> </atlas:UpdateProgress> </form>

Hi JoyTony,

I don't think that its possible to open a new page in another frame without a full postback. (If this is want you want to achieve). I think that Atlas is useful when you want parts of a webpage to be updated not whole pages. I think that the suggestion above with the multiview is the only option. Is there a reason that you don't want to use multiview??

Greetings,

Dennis


Hi Again,

What is the reason that you put your buttons in the update panel? These controls shoudn't be updated right?

Regards


Hmm, it seems you're kinda misusing the concept., although I do see what you're trying to do i think. If I'm not mistaken you're trying to only get the non master portion to refresh, similar to what one would achieve using frames? If so, other than the fact that it's probably not going to work, your pages will not be picked up by search engines, which is really bad unless its an intranet site.

It would be real nice if ATLAS did solve the problem of same masterpage markup being sent back with every page though, but i guess with a well designed site that should be very minimal.

Nick


Thanks Dennis andnicksh.

The reason why i don't want to use multiple view is i've done many pages there.

I just leave it there at the moment untill we really want to change. Thanks.

Saturday, March 24, 2012

Literal nested in UpdatePanel error: "Object reference not set to an instance of an object

I am trying to set the content of a literal which is nested inside an UpdatePanel. But when I try to reference the Literal control, I get this message: "Object reference not set to an instance of an object." This despite the fact that the name shows in Intellisense. Actually, not entirely true. It sometimes isn't showing in Intellisense, for reasons I can't fathom. But I'm not getting a compilation error, so I assume it does recognise the name, but for some reason the object is null. Here's the code:

 <asp:UpdatePanel runat="server" ID="UpdatePanel1" EnableViewState ="true" Visible="true" RenderMode="Block" UpdateMode="Conditional"> <asp:ContentTemplate> <div style="width:350px; height:400px" class="newscontent"> <asp:Literal runat="server" ID="litContent"></asp:Literal> </div> </asp:ContentTemplate> </asp:UpdatePanel>

C#:

protected void Refresh(Object Sender, RepeaterCommandEventArgs e) {if (e.CommandName=="GetContent") {int id = Convert.ToInt32((e.CommandArgument)); ObjectModel.News item =new ObjectModel.News(id); litContent.Text = item.Content; litContent.Text += DisplayDocuments(id); UpdatePanel1.Update(); } }
The Refresh function is triggered by the user clicking on a LinkButton in a repeater, but this is irrelevant to the problem, since I get the same error message if I put a simple line of code in the page load function to set the text property on the the literal.

just yesterday got same problem with accordion control and textbox

spend about 3 hours here how it goes :UpdatePanel1 onpage load or on page init try this code

///////////////////////////////////////////////////////////////////////////

Literal litContent=newLiteral();

litContent= UpdatePanel1.FindControl ("litContent") asLiteral;

////////////////////////////////////////////////////


Sol90046:

just yesterday got same problem with accordion control and textbox

spend about 3 hours here how it goes :UpdatePanel1 onpage load or on page init try this code

///////////////////////////////////////////////////////////////////////////

Literal litContent=newLiteral();

litContent= UpdatePanel1.FindControl ("litContent") asLiteral;

////////////////////////////////////////////////////

Thank you! This worked as far as eliminating my error message went. But even though the code now appears to be doing what it is told, i.e., I can step through it in debug mode and the text property of the Literal is being set to the correct content, the update panel is not displaying the results. It also appears to be doing a full page refresh rather than a partial one. I do have a scriptmanager on the page with EnablePartialRendering set to true.

Load Content after page has finished loading

Hello -

I am not sure what I need to accomplish this task but sounds like something ajax can do. I have a section on my web site where I want to display a random article every time the user goes to a different page on my site. I want the whole page to load and not wait for the article to be pulled form the database and displayed to the page. I also would like the page to not refresh when the article is finally displayed.

Thanks.

You could use a WebService, after the page has finished loading you would call the WebService's WebMethod to get a new article, when you get the article you could use JavaScript and the DOM to show it in the page.

Check out these articles about WebServices:

http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx

http://www.asp.net/ajax/documentation/live/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx

Hi

Start callback immediately after page loaded

If the contents of the panel are very large,you can delay by several seconds to load the content.

You don't need to load it when the whole page load.when the whole page is loading,set the panel unvisible.

Then load the content of the panel.

Code as follow:

<%@. 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 Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
TextBox1.Text = DateTime.Now.ToString();
}
</script>

<script type="text/javascript">
function delayLoad()
{
document.getElementById("<%= Button1.ClientID %>").click();
document.getElementById("<%= UpdateProgress1.ClientID %>").style.display = "block";
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body onload="setTimeout('delayLoad()',3000)">
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<div visible="true"><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
Waiting...........
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</form>
</body>
</html>

More informatin,see:Delaying Content Load using Timer and UpdatePanel ANDControlling visibility of contents of collapsiblepanel

Thanks

Load content on demand or in portions

Hi,

I have large chunks of text (400-500Kb) that are loaded inside update panel when user clicks on a tree node with the book name. It works fine and all. The only thing is that the text is first downloaded to client and then shown - the user will have to wait for the whole 400Kb of text to download. Is there a way to show the first 5-10Kb of text once it has reached the client and keep loading the reast while user is reading?

And one more question - is this ok that Page_Load() event is fired every time UpdatePanel is updated?

Hi abolotnov,

To start with your last question it is normal that the page_load event get fired when you are doing a partial update. The trick is within the rendering of the HTML, so thats correct. What kind of control is inside your UpdatePanel (treeview?) You can use a updateprogress control to make clear to the user that the page is still updating. Can you past some code here so we can analyze your code. Thanks

Regards,


yeah, I know I can use UpdateProgress control to tell the user that the page is still updating... this is not I really want though -

say I have this UpdatePanel with DIV inside of it and need the text in DIV to be updated. The text is 400K - quite a lot for people with slow internet connection (dialup for example). I want them to be able to start reading the text before it's downloaded in whole. Say, if their connection speed is 4K/sec, they will be able to start reading in 1 second - 4K of text gives them enough to read before the rest is downloaded - another 4k will come next second etc.

What I have now is when the update starts use sees this message "content for reading pane is being updated, please wait" untill the whole portion of text is downloaded and then rendered. For people on slow internet connections it takes quite a while 400/4 secs.


Don't ask me why I can't split the text into smaller portions and allow users to page through the text - I will if there is no way to sort out what I want.

Thanks for any comments you may have on this.

Load different content pages in content place holder without refreshing the whole page usi

Hi,

I have built a ajax enabled website, where i have a master page which holds a content placeholder, and two content pages, where one is the home screen and another is a dashboard, a menu is placed in master page , by default home page is made to display, when the menu item dashboard is clicked , the the contentplace holder should load the dashboard page without postbacking the whole page, how to do that through ajax? Pleas help me.....

Its very urgent, I am stucked.....

hello.

i'd say that you cannot do that in your scenario. i'd refactor the site and transform the contents of the main page and the other page in user controls. then, i'd build only one page set its content to one of the user controls...


Luis Abreu:

hello.

i'd say that you cannot do that in your scenario. i'd refactor the site and transform the contents of the main page and the other page in user controls. then, i'd build only one page set its content to one of the user controls...

Hi Luis,

I am new in creating webapplication. I am not able to get what u'r saying.

Plese explin me in details, What is usercontrol ? How does it satisfy my needs?

Please help me. Give me an example, whre they have used user control .....

Thanks in advance


here's an old post that shows how you might change the user controls on an udpate panel:

http://msmvps.com/blogs/luisabreu/archive/2007/02/15/adding-controls-to-an-updatepanel-through-code.aspx

regarding the user control part, well, it's really the easiest way you have to develop a control. i think that if you go to the asp.net site, you'll be able to get lot of info from the quick starts

Load in-line javascript functions after UpdatePanel refresh

I have a lot of user controls that have in-line javascript functions specific to the content of the user control, validations and automated reactions. This javascript is written mostly by client side developers. Is there any way to allow them to keep writting their in-line javascript on the user controls, but still have that javascript be active after an updatepanel conditionally makes the user control visible? For example imagine a page with a button and the user control. The user control is in an update panel tiggered by the button click. When clicked the user control has its visibility set to true and the user interacts with the newly visible controls contained within. Because the user control was initially in an update panel, the original page source does not contain the in-line javascript functions so they are never evaluated by the browser. In order to keep the client side group's functionali i've had to recreate the client side code on the server side by building a large string that references controls using the control.ClientID property (just like the client side group does with inline scriplets $get(<%= control.ClientId %>) and then registering this string on the page with ScriptManager. This is too inefficient a process and having the javascript placed on every page that uses the user control seems counter productive with regard to user controls. Placing all the javascript in external files that get loaded by ScriptManager is also not an option as the javascript is often control specfic. Is there no way to get the browser to recognise the in-line javascript after an update panel loads it? Is this something that is planned for the future if not?

Well, I don't know if it is the final solution, but I figured that I could use display:none and display:block on a panel wrapping the user control instead of using the Visible property on the control itself. This way the control (and most importantly the javascript) is initially rendered, but not browser visible. If there is still some way to use the built in Visible property to do what I want, please let me know. I like that the inital page load using the Visible property doesn't have the extra weight of controls that are not usuable.


You can give this approach a try:http://blogs.msdn.com/sburke/archive/2007/06/13/how-to-make-tab-control-panels-load-on-demand.aspx

-Damien


I believe that approach will suffer from the same issue. The tabcontainer content will not be initially visible and so any inline javascript contained in a tabcontainer will not be evaluated by the browser.


Sorry about that I miss read your question. If the JS is embedded in the usercontrols they need to be loaded, so your solution works. I'm a bit confused why you need the JS loaded if they are control specific. Sounds like there may be a design problem with your solution.

-Damien

Load Tab Content when user selects the Tab

Hello,

I am creating a web page with two different tabs. The data for both tabs is from single aspx file under a single Content.

How can i make my second tab load its content when user clicks it?

Regards

HI .

When you click on one Tab . data will be populated from DataBase or its only Static Content .IF it is Static Content then Use Div for Each Tab and Clicking on tab Show one Div and hide another div


Both tabs are Gridviews data (data populated from database).

As of now, my page has both grids loaded with data and it just loaded once from the server.

But like i said, i need the second Tab only populated when user clicks it.


take a look at this link... its help ful

http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html

Wednesday, March 21, 2012

Loading an Atlas enabled UserControl Dynamically. Urgent!

Hello,

I have 2 buttons within an UpdatePanel (for the menu) and another UpdatePanel (for the Content) where I load a control depending of the menu clicked.

MyControl1.ascx and MyControl2.ascx both content an UpdatePanel too.

Default.aspx:

<%@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%>

<html>

<headid="Head1"runat="server">

<title></title>

<Atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"/>

</head>

<body>

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

<div>

<Atlas:updatepanelid="UpdatePanel1"runat="server"mode="Conditional"rendermode="Inline">

<contenttemplate>

<asp:ButtonID="Button1"runat="server"Text="Button"OnClick="Button1_Click"/>

<asp:ButtonID="Button2"runat="server"Text="Button"OnClick="Button2_Click"/>

</contenttemplate>

</Atlas:updatepanel>

<br/>

<Atlas:updatepanelid="UpdatePanel2"runat="server"mode="Conditional"rendermode="Inline">

<Triggers>

<Atlas:ControlEventTriggerControlID="Button1"EventName="Click"/>

<Atlas:ControlEventTriggerControlID="Button2"EventName="Click"/>

</Triggers>

<contenttemplate>

<asp:PlaceHolderID="PlaceHolder1"runat="server"></asp:PlaceHolder>

</contenttemplate>

</Atlas:updatepanel>

</div>

</form>

</body>

</html>

Default.aspx.cs:

using System;

using System.Text;

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;

publicpartialclass _Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

}

protectedoverridevoid OnInit(EventArgs e)

{

base.OnInit(e);

if (Session["ContentControl"] !=null)

{

Control c = LoadControl(Session["ContentControl"].ToString());

PlaceHolder1.Controls.Add(c);

}

}

protectedvoid Button1_Click(object sender,EventArgs e)

{

Session["ContentControl"] ="/MyContent1.ascx";

}

protectedvoid Button2_Click(object sender,EventArgs e)

{

Session["ContentControl"] ="/MyContent2.ascx";

}

}

MyContent1.ascx:

<%@dotnet.itags.org.ControlLanguage="C#"AutoEventWireup="true"CodeFile="MyContent1.ascx.cs"Inherits="MyContent1"%>

<IGI:updatepanelid="Updatepanel1"runat="server"mode="Conditional"rendermode="Inline">

<contenttemplate>

MyContent1

</contenttemplate>

</IGI:updatepanel>

MyContent2.ascx:

<%@dotnet.itags.org.ControlLanguage="C#"AutoEventWireup="true"CodeFile="MyContent2.ascx.cs"Inherits="MyContent2"%>

<IGI:updatepanelid="Updatepanel1"runat="server"mode="Conditional"rendermode="Inline">

<contenttemplate>

MyContent2

</contenttemplate>

</IGI:updatepanel>

My problem is I have to click twice on a button for the Content control to load because the OnInit is executed before theButton1_Click.( the session is not updated yet when the OnInit is executed );

Anybody has an idea to achived this in One Click??

Many Thanks,

Yann

Did anyone every respond to you on this question? I am having the same problem, and I could only solve it (kind of) by using a master page.

I wrapped the ContentPlaceHolder in the master page inside an UpdatePanel, and in my actual page, I put another PlaceHolder for holding my dynamically created user control (or other type of control based on my portal's configuration).

I would like to know if anyone ever answers this, and I would also like to be able to use WebParts in this scenario, which I have NEVER gotten to work with Atlas and dynamic user controls reliably.

loading content in Accordion Pane Dynamically

Is it possible to dynamically fetch the content when a user clicks on a header of the accordion pane?

The content for the accodion panes in my solution is rather large and I would only like to show it for the selected panes.I would like to show the headers and all of the panes collapsed initially. But when a user clicks on the header, I would like to dynamically fetch the content and show it just for that pane.

An example or tips on how to do this would be much appreciated.

Thansk,

jsidhu

Hi Jsidhu,

Please refer to this thread: http://forums.asp.net/p/1129397/1792511.aspx

It implements a similar function on ModalPopupExtender, you can easily apply it to Accordion.

loading page and click in any button

I am facing this problem lot , when page is downloading content and in between this user click on any link then we got error page.

and this error details insert in the database

System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
at System.Web.HttpResponse.Redirect(String url, Boolean endResponse)
at System.Web.HttpResponse.Redirect(String url)
at framework_GacStore_OrderList.GetGACOrderList()
at framework_GacStore_OrderList.Page_Load(Object sender, EventArgs e)


Would you mind posting the code?


Hi pawan_mca03

I am afraid we cannot find out the exact root cause without further information .So I suggest that you'd better share your source code here. If your problem has been resolved , Sharing your work will be greatly appreciated.