Showing posts with label load. Show all posts
Showing posts with label load. Show all posts

Wednesday, March 28, 2012

List Search extender - activation on first load

Hi all,

I've encountered a probem with using the List Search Extender. These controls work fine during general use throughout my project (when the dropdown is selected by either clicking or tabbing on to the control).

However, on several pages I am seeking to set the focus to a dropdownlist which has an associated ListsearchExtender during the initial loading of the page. If I attempt to do this using simply:

Dropdown1.Focus()
or
 
ScriptManger.GetCurrent(Me.Page).SetFocus(Dropdown1)
 
.. I encounter a problem - the dropdown is focussed successfully but the listsearchextender is not activated - the user must click off the dropdown then re-select it.
 
I did find the following code useful:
 
 
function pageLoad() { var extender = $find('<%=lseCust.ClientID%>'); if (extender) { extender._handleFocus(); } }
 .. which I successfully activated the listsearch on page load. However, this also activates it across all postbacks, which is not appropriate.
 
Ideally, I would like to be able to "force" the listsearch to activate in all instances when the control is subject to focus, so I tried the following:
 
 
<script type="text/javascript">function ActivateListSearch() { var extender = $find('<%=Dropdown1.ClientID%>'); if (extender) { extender._handleFocus(); } } </script>Page_Load(ByVal sender as object,ByVal e as System.EventArgs)Handles Me.Load
 Dropdown1.Attributes.Add("onfocus","ActivateCustListSearch()")End Sub
 
.. but this doesn't activate the list search during the first page load (no error is encountered), although the listsearch is operational when the user clicks or tabs onto the dropdown.
 
Has anyone else encountered this issue or found a workaround for it? 
 

Hi,

I think you can use the second parameter of pageLoad method to determine if it's a partialPostback.

For instance:

function pageLoad(sender, args) {
if(args.get_isPartialLoad ()) return;
var extender = $find('<%=lseCust.ClientID%>');

if (extender)
{
extender._handleFocus();
}
}


Monday, March 26, 2012

ListView & set_itemTemplate(): how it works?

Hello,

It′s possible to set templates for ListView through javascriptor load a string with the declarative template?

Thanks,
Ivan Paulovich

first you must create and register class template

Type.registerNamespace(

"ViewTemplate" );

ViewTemplate.MainTemplate =

function( element ) {var _element = element;this.createInstance =function( containerElement, dataContext, instanceElementCreatedCallback, callbackContext ){var result =new Sys.TemplateInstance();

result.instanceElement = _element.cloneNode(

true );if( !Sys.Application.getMarkupContext().findObject( element.id ) ) {

Sys.Application.getMarkupContext().addObject( element.id, element );

}

result.callbackResult = result.instanceElement.childNodes[0];

containerElement.appendChild( result.instanceElement );

createControls(dataContext);

return result;

}

this.initialize =function() {if( _element.parentNode ){

_element.parentNode.removeChild( _element );

}

}

this.dispose =function() {

_element =

null;

}

}

ViewTemplate.MainTemplate.registerClass(

"ViewTemplate.MainTemplate",null, Sys.UI.ITemplate, Sys.IDisposable );

then

var itemView =new Sys.UI.Data.ItemView($("itemView"));

var itemplate =new ViewTemplate.MainTemplate($("template"));

itemView.set_itemTemplate(itemplate);

itemplate.initialize();

itemView.initialize();

Saturday, March 24, 2012

Load a new page into a modal popup.

Hi. I need to implement a chat in a website for technical suport online. But I'd like to do that in a modalPopup, i need start to load a page into a modal with some parameters is it possible in a modal, or maybe i need to work with a normal popup or a prototype windows framework?

Have a look at this Javascript tutorial for opening a modal windowhttp://javascript.about.com/library/blmodal.htm


Sure, you can use the modal popup. All the modal popup does is show/hide a DIV, so the container can contain just about anything you want...

Seehttp://www.asp.net/ajax/ajaxcontroltoolkit/samples/ModalPopup/ModalPopup.aspx for a demo.

-Damien


Hi,

You can use normal popup or AJAX modal popup with a frame in it.

To use AJAX modal popup with a frame in it,please check out the following link for more information:http://forums.asp.net/p/1160057/1919992.aspx#1919992

Best Regards

Load a javascript file in an updatepanel

Ipresent the context to you. I have a project principal compound of anupdatepanel. When I click on a button, I filled my updatepanel with a"templatd control". This one appears well. This control haves embeddes resources (images + Javascript file). My problem is that my control charges only the images and not my Javascript file. When I use this control in a simple page, it works correctly. I think that it is impossible to charge a fileJavascript in a updatepanel. What do you think about it? Thank you inadvance for your answers.

Damien

Damien,

Personally what I would do as UpdatePanel makes a server request to do your processing in the postback server side, easier and cleaner, you already in the server, then why not. Putting javascript with the UpdatePanel, why? the UpdatePanel is to go to the server without the user to see the request, then just use that!

Makes sense?

Load a web page, play with the html code and paste in a DIV

Hi,

I have a default.aspx page and I want one of it's frames to present a web page from another site. I tried using JS AJAX and found that is is impossible to do this across sites. It there a way to get the server to get a web page, allow me to play with it's html code and then paste it in a div in default.aspx?

I know how to get my I default.aspx page to invoke a function on WebServer.asmx, but have no idea how to get a web page in VB. Can someone explain how / redirect me to an explaination?

Thanks
Yoni

Check this article:http://msdn2.microsoft.com/en-us/library/system.net.webrequest.aspx


If it's in a frame anyway, it seems like you might be adding needless complexity by trying to do this on the client side. For good security reasons, there will always be limitations on what you can do cross-domain on the client side.

You could just set that frame's src to a RemoteContent.aspx (or whatever) page on your site, and have that make the web request on the server side, manipulate it how you want, and then present it.


gt1329a:

If it's in a frame anyway, it seems like you might be adding needless complexity by trying to do this on the client side. For good security reasons, there will always be limitations on what you can do cross-domain on the client side.

You could just set that frame's src to a RemoteContent.aspx (or whatever) page on your site, and have that make the web request on the server side, manipulate it how you want, and then present it.

and how can I do this? also, can I put it in an iframe?
Thanks,
Yoni


MSDN has good information on how to use the WebRequest class (as someone else linked above): http://msdn2.microsoft.com/en-us/library/system.net.webrequest(VS.80).aspx

It would work fine in an iframe. Just set the iframe's src to your RemoteRequest.aspx (or whatever) and have that do the processing on the server side and output what you want to appear in the iframe.


gt1329a:

MSDN has good information on how to use the WebRequest class (as someone else linked above): http://msdn2.microsoft.com/en-us/library/system.net.webrequest(VS.80).aspx

I tried to get the following page but keep getting a timout error:
http://he.wikipedia.org/w/index.php?title=%D7%AA%D7%91%D7%A0%D7%99%D7%AA:%D7%94%D7%A2%D7%A8%D7%9A_%D7%94%D7%9E%D7%95%D7%9E%D7%9C%D7%A5&action=render
Why won't Microsoft's WebRequest example work with this page?
Yoni


I'm not sure why that would time out. Is there anything blocking outbound connections to port 80 on the server you're testing this on?

Another thing you might want to look at issetting the request's user agent to a popular browser's. Wikipedia might have some sort of restrictions in place to deter scrapers from stealing its content.


Thanks. I managed to load the page using the following code:

Dim wcAs WebClient =New WebClient()wc.Credentials = CredentialCache.DefaultCredentialswc.Encoding = System.Text.Encoding.UTF8wc.Headers.Add("Content-Type","application/x-www-form-urlencoded")wc.Headers.Add("User-agent","User")Dim resAs Uri =New Uri("http://he.wikipedia.org/w/index.php?title=%D7%AA%D7%91%D7%A0%D7%99%D7%AA:%D7%94%D7%A2%D7%A8%D7%9A_%D7%94%D7%9E%D7%95%D7%9E%D7%9C%D7%A5&action=render&ctype=text/plain&dontcountme=s")Return wc.DownloadString(res)
Thanks for your help.

Load an aspx nto another aspx with ajax

HI

I have a aspx page with a table and 1 DIV tag. I have a another aspx page with table and 2 maskedit ajax control toolkit.

I want to load second page into DIV of first page when user load first page. I want to show progress bar and after load completed second page added into first page (DIVpart)

can anyone help me for writting this code?

best reagrds

Not sure about the divs but you can accomplish this with .Net and Masterpages and multiple contentplaceholders...


Thank you for replying my post.

But can you write a small example for me that I can insert a aspx page into another one with AJAX. I need second page has a maskedit control toolkit and I can insrt it into first aspx page.

Best regardsEmbarrassed


Really sorry I can not - as I stay away frm master pages where possible -- however you can take a look the AjaxControl ToolKIt sample website (which you can download) and play around with it for yourself...

Load an script at first.

The scriptmanager will Load the script at last (when all of page loaded).

How to load the script at first (before all object of this page) as this page do:

http://www.pageflakes.com/

Thanks for reply!

(Sorry because my English)

hello.

have you tried using the registerclientscriptblock method?


uh!, Thanks your suggest from you, I will try it. Thanks.

Load another url without postback

How can i load another url without postback using a hyperlink?

Set theNavigateUrlproperty

<asp:HyperLinkID="HyperLink1"NavigateUrl="~/ViewFiles.aspx"runat="server">HyperLink</asp:HyperLink>


yes i know navigateurl but i mean without refreshing to page .
Navigate URL property won't create a postback. To check this have a Break Point in Page_Load and try clicking the hyperlink.Your page_Load won't trigger
AshokRaja eisai vlakas
Ontws tragiko... Kai fantasou oti o tipos exei apanthsei kai se allous...

Load ascx in other Page using Ajax

I have one application, which has one Home.aspx, Head.Ascx and Footer.Ascx, Head.aspx has two button, And all controls of head.ascx and footer.ascx in ajax panel, now in home page when i click on one button then i want to load head.ascx in my Home page and if i click on second button then i want to load footer.aspx in Home page and unload Head.ascx. I am using ajax in my application. But not enable to solve this.

Thanks

Hi,

Here is an example made according to your requirement:

<%@. 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 btnHeader_Click(object sender, EventArgs e) { ViewState["show"] = "h"; } protected void btnFooter_Click(object sender, EventArgs e) { ViewState["show"] = "f"; } protected void Page_PreRender(object sender, EventArgs e) { if (ViewState["show"] != null) { string show = ViewState["show"].ToString(); if (show == "h") { Control ctrl = this.LoadControl("Header.ascx"); PlaceHolder1.Controls.Add(ctrl); } else { Control ctrl = this.LoadControl("Footer.ascx"); PlaceHolder1.Controls.Add(ctrl); } } }</script><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="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Button ID="btnHeader" runat="server" Text="Show Header" onclick="btnHeader_Click" /> <asp:Button ID="btnFooter" runat="server" Text="Show Footer" onclick="btnFooter_Click" /> <asp:Button ID="Button3" runat="server" Text="Another Button" /> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>

Thanks Raymond Wen , it solved

Load atlas js resource before charging page

Hi

Is it possible to load all Atlas resources on client before charging a page using Atlas ?
In fact, using Atlas means getting big javascript resources (near 300 ko for a page using webservice and updatepanel both).

My ideas is to :
- Load Atlas resources (with a loading message)
- And after load the page using Atlas

Thanks for your help.
ClémentM

hello.

well, the loading time should only hit you the 1st time the atlas files are loaded (they should be cached for future calls).

you can, however, show a loading msg. to dismiss it, you can handle the load event of the sys.application object.

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 Control. Need Advice.

Hello,

I have a page with a TreeView and a Panel.

I created 10 WebControls which are compiled into a dll library.

My TreeView has 10 nodes. When I click a node I want to show, in the panel, one of the 10 WebControls without refreshing the page.

How can I do this?

Thanks,

Miguel

Hi,

If UpdatePanel is ok for you, the folowing sample is quite similar to what you have described

http://www.couldbedone.com/downloads/DynamicallyCreatedControlsAjax.zip

-yuriy


hello.

here's an old post I've written about that subject:

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

Load data into server controls

I am using Atlas to get a list of Serial numbers from a database as the user types in part of the serial number. It works great. Now I want to be able to populate other textbox controls on the form as the user types in that serial number. Is this possible using Atlas? I know I could put a button next to the serial number so when they get the serial number they are looking for they could submit the form and I could do a "SELECT * FROM inv_assets WHERE sserial_num = txtSerialNum.Text, but this would cause the page to refresh and I would really like to somehow populate the rest of the form as the user types in the serial number.

perhaps using a placeholder into an updatepanel.

Load datas dynamically to ASP.NET AJAX Modalpopup Extender

Hai Friends,

I have Gridview in a page. When a each row in the Grid is Clicked, I need to load the all details regarding that selected row from the DB to an AJAX Modal popup extender. How to use DynamicControlID, DynamicContectKey, DynamicServiceMethod properties of Modal popup to achieve this. I don't have or need any Updatepanel in the web page. Please reply a solution

Sreejith

See this posthttp://forums.asp.net/p/1068303/1551580.aspx

-Damien


Hi,

See this great article wrote by Brian Smith :Displaying Extended Details in a GridView Using an Ajax Pop-Up (Part 1) Part 2

As web developers we are often tasked with building online reports. ForASP.NET 2.0 web applications, the GridView control is commonly used to display report data. A common challenge in building reports is achieving the right balance between readability and information. Users want to have all of the pertinent information available on one screen, but too much data dumped on a single screen leads to information overload and makes the report difficult to digest. Oftentimes, a report displays the high-level information and enables users to drill down into the details. One way to implement drill down details is to add a link to each item in the report that, when clicked, takes the user to a page that shows the selected item's details. This approach works well if the details displayed require significant screen real estate or if the user is likely to only want to view a particular item's details. If, however, a typical user needs to view the details for many items, having to go to a separate web page to view each item's details can be counterproductive. An alternative approach is to have a window appear on screen when mousing over a particular item that would show the item's details.

At work I was asked to build such a report interface: a GridView showing high-level details that, when moused over, show their details in an on screen pop-up window. I decided to useMicrosoft's ASP.NET AJAX framework to accomplish this task. In this article, I'll show you how to build your own dynamically-generated pop-up window filled with extended information about an item in a GridView. This is the first of a two-part article series. In this part we'll look at building the application architecture, which will consist of a Typed DataSet and some custom classes. In a future installment we will look at implementing the Ajax-related functionality. Read on to learn more!

For more information, see:

Dynamic content made easy [How to: Use the new dynamic population support for Toolkit controls]:http://blogs.msdn.com/delay/archive/2006/09/19/762609.aspx

Both the two articles demonstrate what you need do.

Best Regards

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 external url in page?

I have a treeView that lists SQL Reports available to the user. What I'd like to do is put the treeView into an Update Panel, and some other control that can display an external url, next to the treeView so that when a user clicks on a report, it fetches the contents of the url and displays it without doing a postback. So my question is, are there samples of this out there (I couldn't find any) and if so, what control would allow me to load external content into it (like an iframe)? I realize I could do the same thing with a div or iframe using javascript, but I'd like to use ajax if possible...

Thanks!

eddie

Chao,

I would put the iframe inside the UpdatePanel and the Trigger controling the URL's ID from the treeview. This is similar to having a gridview or any view inside an UpdatePanel with a trigger controlling a button. The button is of course outside the UpdatePanel.

WS

p.s. not responsible for not working ... hihihi ... but that's how i see it.

Load external HTML file

Hi All,

I'm very new to this (Ajax & ASP) and am trying to implement something which I think should be stright-forward but am having no luck.

Basically I want to load an external html file (or html snippet) into a section of the current web form/page, I don't want to use iframes for this. I have an idea that I might need to use an UpdatePanel and maybe a DynamicPopulateExtender but can't piece it together.

Any help/direction greatly appreciated . . .

Hi,

How do you plan to use UpdatePanel & DynamicPopulateExtender?

I think IFrame is a good choice for such situation.

Load Foreign Website into Tab

Hi,

I am using the tabpanel from the AJAX toolkit, and have created multiple tab panels...for each panel I want to load a new site into it...

For example:

Tab 1 -www.asp.net

Tab 2-www.google.com

etc etc...

Does anyone know how I can do this at all?

Thanks

Hi,

You can add iFrames to the different tabs.

More info:

http://www.w3schools.com/tags/tag_iframe.asp

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

Regards


Thanks!

Load from database...clicking on title!

Hi!
I'd like to insert a new ajax.net idea inside my homepage.
I'd like to realize this, and i hope you can help me. (i'm italian, excuse me for my english!!)
In my homepage, i load last 15 messages from my forum (via mysql database). These messages are loaded with title and body and show with an ajax.net accordion.
I'd like to load only last 15 titles and load the body only when user click the title. This message will show below title and will hide if user re-click over title.
Obviously, i'll load body message from database using updatepanel, so, not all page will be reload but only that, showing to the user that a loading is in progress.

I hope you can help me.
I need it!! :)
Thank u so much!

You can set your "title" as a trigger for your UpdatePanel. You can start here:http://www.asp.net/AJAX/Documentation/Live/tutorials/UpdatePanelTutorials.aspx and you should find some good examples for loading data into and UpdatePanel as well as adding triggers.

-Damien