Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Wednesday, March 28, 2012

Line break problem in ASPNET AJAx


I am using ASP.NET AJAx 1.0 Framework.

The page is diplayed perfectly first time. But after a asynchronous post back an extra line added between the Header and the user control.

And no Styling related operations are done in the postback call.

I have compared the HTML that is generated before and after the call. But both are identical.

And I think the reason is that we cant see the modification made by the Ajax Asynchonous calls to the HTML file at the client side.

Does it possible to see the modified HTML code in the browser after a Ajax call to the server?

I don't know the exact solution to your problem, but, If I were you, I would use Fiddler

http://www.fiddlertool.com/

to see what's going on. Fiddler is an excellent HTTP debugging proxy, that monitors each and everyone HTTP request.


Fiddler's good for seeing the reqeust/response. IE Dev toolbar or Firebug are essential for seeing the 'live' DOM.


And this line break problem appears only in IE. Its working fine in Firefox 1.5.


Hi,

There are some useful tools in our daily development work.Such as:

IE: Fidder、IE Dev Toolbar、Instance source、HttpWatch、Web Development Helper(especially for UpdatePanel)

Firefox: Firebug

Hope it helps!

Lines and Arrows with Ajax

Hi,

I am trying to create a CASE tool(UML diagrams) on Web using ASP.NET 2.0 andAjax(Atlas). The problem is that I do not know how to create lines and arrows (links between elements).


Is it posible?

Please, help.

JavaScript is very limited to images. SVG and Canvas is what you would have to look into.

Eric

LinkButton plays "click sound" (postbacks the whole page?)

Hi,

This is my first post here at the ASP.NET forums and I'm not sure if I'm in the correct category, so please correct me if I'm wrong.

My question concerns the LinkButton when used with AJAX .NET 1.0 RC1. I have a GridView inside a UpdatePanel. Inside that GridView there are various controls, some of them LinkButtons. When I click, for example, a ImageButton the UpdatePanel refreshes without making any "click sound" (the sound that Internet Explorer plays when a new page is requested). However, if I click a LinkButton the click sound is played. Why is this? If I replace all LinkButtons with normal Buttons or ImageButtons no click sound is heard, so the issue seems related to the LinkButton only. Is this behavior by design, or am I doing something wrong? Is the whole page postbacked when I click a LinkButton even if it resides in an UpdatePanel?

Thanks in advance!

If you place a asp:LinkButton in a asp:UpdatePanel and specify asynchronous post back, there should not be the whole page postback.Try to google "Click Sound" of the asp:LinkButton for some ideas.Maybe this is caused by the designers, which there is sound when clicking a asp:LinkButton.

List Box and the update panel

I would like to know the event name to use when an ASP List Box is used with the update panel control. I would like the updatePanel to fire when the ListBox Selected Index Changed event occurs.

Thank You for any help

George

<asp:ListBoxID="ListBox1"runat="server"DataSourceID="AccessDataSource1"DataTextField="product_name"DataValueField="product_id"Rows="30"CausesValidation="True"></asp:ListBox>

<asp:AccessDataSourceID="AccessDataSource1"runat="server"DataFile="~/App_Data/test.mdb"SelectCommand="SELECT [product_id], [product_name] FROM [Products]"></asp:AccessDataSource>

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

<atlas:UpdatePanelID="up222"Mode="Conditional"runat="server">

<Triggers>

<atlas:ControlEventTriggerControlID="ListBox1"EventName="SelectedIndexChanged"/> <!-- DOES NOT FIRE -->

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

</Triggers>

<ContentTemplate>

<asp:LabelID="Label2"runat="server"Text="Labe354"></asp:Label>

</ContentTemplate>

</atlas:UpdatePanel>

You have everything exactly right, though it might not actually be what you want. Every time the SelectedIndexChanged event is raised, or the button is clicked, the UpdatePanel will be updated. However, to get any of that to happen, a postback must occur. In your sample page, the only way to get that to happen is to click the button. To make the page update immediately when the list selection changes, add this property to your ListBox: AutoPostBack="true"

Thanks,

Eilon

List<object> from ASP .NET to javascript

Hi,

I would like to know if it is possible to use List<object> as parameter in an AjaxExtender??

[ExtenderControlProperty]
[DefaultValue("")]
public List<object> HandlerFieldList
{
get {return GetPropertyValue<object>>("HandlerFieldList",null); }
set { SetPropertyValue<object>>("HandlerFieldList",value); }
}
<cc2:AjaxControl4WebGridExtender ID="AjaxControl4WebGridExtender1" runat="server"
TargetControlID="GenericTimeGrid1"
TargetID="GenericTimeGrid1" ServiceMethod="executeCommand" HandlerFieldList="argList">

By trying these I get the following error:

 Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Cannot create an object of type 'System.Collections.Generic.List`1[[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' from its string representation 'argList' for the 'HandlerFieldList' property.

perhaps should I say: the argList is defined in Default.aspx.cs and field also there in Page_Load()

regards Omid

Is that linst object is in the UpdatePanel ??

Idea


no it is not... aren't there some TypeConverter for it in ASP .NET oder the Ajax Toolkit...?

I think I have to write an converter for it..

Saturday, March 24, 2012

Live chat with ajax and atlas

Live chat built by ASP.NET 2 technology with AJAX and ATLAS support, which mean 100% web browser base. Does this mean it is faster, safer and more flexible?

Based on my experience in developing chat application using ASP and AJAX. You bet it would be more presentable with AJAX, especially if you are aiming to build database chat. As you would be avioding many page refreshes at run time. Page post is the most common (or should I say annoying) issue which you would be coming across in your ASP chat project.

However as we all know that AJAX is still in its beta, so there are some flexibility issues, which I am sure would be taken care of in the final release of AJAX. And I am sure everyone is waiting for it :)

Cheers
Ritesh


Hi Ritesh, i'm trying join all the information related with live chats / web messengers / instant messengers that uses the AJAX / ATLAS technology in an unique post.

So all the users that is encountering dificults to start with applications of this type, just like me, can help each other publishing informantions about this issues.

If you want join us, the post is:http://forums.asp.net/thread/1580610.aspx

But there's another post so much interisting when the friendjodywbcb put the a link from a ASP chat project very interisting developed using ATLAS.

I recommend you visit too, the link is:http://forums.asp.net/thread/1580610.aspx

So join us.. .let's start a project or just share great informations...

See ya there

Kalel

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 Page in DIV

Hello,

if someone can help me, I'm newbie on ASP.NET and I'll try to find information about best practice to include aspx page of my site in DIV (AJAX) when a user click on link in the navigation menu

like this : http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm#combo

I didn't find any good article or tutorial about this in ASP.NET AJAX :-(

Can I find specific control in control toolkit or future ctp ?

Thansk a lot for your help

read this article if you want to load a page with in the div element.

http://www.xul.fr/ajax/responseHTML-attribute.html

For latest ctp and downloads.

http://www.asp.net/ajax/downloads/


Thanks for this link !

Is it a better solution to use updatepanel control (trigger by menu link) and ascx user control inside this updatepanel ? if yes, someone know where I can find good tutorial for this ?


See this link

http://asp.net/ajax/documentation/live/tutorials/UsingUpdatePanelUserControls.aspx

Wednesday, March 21, 2012

Loading external .aspx file into AJAX Toolkit TabPanel

Hello,

I'm new to ASP.NET AJAX. I want to create a default page, maybe a master page. then i want to add the AJAX Toolkit TabContainer with different TabPanels for each of my other .aspx files (home.aspx, about.aspx, etc.) I want to know how I would setup the TabContainer with a tabpanel for each page and load those pages when the appropriate Tab is clicked. a small snippet of example code would be greatly appreciated

Thanks to all in advance

GL

How about something like this?

<ajaxToolkit:TabContainer ID="tabs" runat="server" Width="600px" Height="400px">
<ajaxToolkit:TabPanel ID="tabHome" runat="server" HeaderText="Home">
<ContentTemplate>
<iframe src="http://pics.10026.com/?src=home.aspx" width="100%" height="100%">
</iframe>
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabAbout" runat="server" HeaderText="About">
<ContentTemplate>
<iframe src="http://pics.10026.com/?src=about.aspx" width="100%" height="100%">
</iframe>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>


Thanksctafield, that did the trick. works like a charm but I wonder if there might be another way besides frames. I dont like to use frames plus i'm concerned about browsers that may not support frames. Thank you for the quick response

If there is another way I would greatly appreciate the guide

Thanks

GL


Ok, When I used the iframe my pages end up having 2 separate vertical scrollbars. one for the main window and one for the iframe region. i cna see that confusing my users when they need to scroll up or down. has anyone thought of another solution?

you can actually turn off the scrollbars for the iframe - just make sure you set its width and height to 100% so data doesn't get chopped and that would get rid of the scrollbar for the iframe...

<

iframeid="TargetPane"scrolling="no"


Hi,

You might also be interested in reading one of Scott Guthrie'sblog posts where he created a class called ViewManager to render ASP.NET controls to HTML and send it via a webservice to the page.

Thanks,
Ted


You can add WebControls (.ascx) to each panel you want by using following code-behind:

AjaxControlToolkit.TabPanel tpHome = new AjaxControlToolkit.TabPanel();
tpHome.HeaderText = "Home";
tpHome.ContentTemplate = Page.LoadTemplate("Home.ascx");
tcDefault.Tabs.Add(tpHome);

AjaxControlToolkit.TabPanel tpAbout = new AjaxControlToolkit.TabPanel();
tpAbout.HeaderText = "About";
tpAbout.ContentTemplate = Page.LoadTemplate("About.ascx");
tcDefault.Tabs.Add(tpAbout);

tcDefault is TabContainer control.


AjaxControlToolkit.TabPanel tab = new AjaxControlToolkit.TabPanel();
tab.HeaderText = "test_new_tab";
TabContainer1.Tabs.Add(tab);

??index error WHY?

Good piece of code to use the control on the code behind.
Even the control toolkit samples didn't have these in detail

However i couldn't load an external page onto the page.loadtemplate method
It throws the following error when trying with full path


Exception Details:System.Web.HttpException: 'http://localhost:8080/Documents/9245/bjk49000.PDF' is not a valid virtual path.

Any suggestions?

Rain Man


At the moment i'm using the following method by coding on the client end

<ajaxToolkit:TabPanel runat="server" ID="TabPanelAttachment" HeaderText="Attachments">
<ContentTemplate>
<iframe runat="server" id="iframePreview" width="850" height="800" frameborder ="0"> </iframe>
</ContentTemplate>
</ajaxToolkit:TabPanel
var urlPrefix = "http://localhost:8080/Documents/"
var urlSuffix = docId + "/" + fileName;
var url = urlPrefix + urlSuffix;

$find('TabContainerDocument').set_activeTabIndex(1);
document.getElementById('TabContainerDocument_TabPanelAttachment_iframePreview').src = url;

TabContainerDocument_TabPanelAttachment_iframePreview is the iframe id at run time
Hope that helps for someone who is trying on something similar

Happy coding

Rain Man


This reallyhas to be built into the TabPanel tool.


Haven't tried this but it might be another alternative to controls and iFrames...

Dynamic drive website has example of using Javascript to do page calls to a div, not too sure if will work in but might be good for a try?

http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

Dave

loading web user controls asynchronously

I am new to asp.net ajax. I want to load multiple web user controls in a aspx page independently after the page has been loaded so that user will know that something is happening in the page rather than showing them blank screen. IS there a way to do it using Ajax or is it not possible to do so?

any help would be appreciated

You could have update panel for each user control that have a timer set as their trigger. When the timer elapses, load the user control you want into each update panel. use an update animation in each to let the user know something is happening.


This seems a bit backwards. UserControls become a part of the page itself, so delaying their "loading" isn't likely to help you. If you want to show some sort of progress or other indicator to the user while the page is processing, you can do that with an animated gif or with Remote Scripting ("AJAX").


how can i achieve remote scripting using asp.net ajax. The problem is i have couple user controls that runs heavily in database and it takes about 5 seconds to finish. I want to display the remaining content in the page while the user control is loading.

please help.


hello.

well, the only option i see is to laod the page without that content and then call a web service from the client side that gets the data from the server and presents them to the user. you should keep in mind that an asp.net page generates html that is sent back to the client. this means that you cannot sent the page to the client with "wholes" that will be filled up later...it simply doesn't work like that!


It's true you can't leave holes in the HTML, but that doesn't mean you need load everything at one time.

If you modify your user control to not load the data that takes five minutes on page load, but only to load it when a certain method is run you can load the user controls in the update panels as I suggest above and then you can trigger the data to be loaded into it via a timer, or a java script function that runs when the page loads in the client's browser.


hello again.

true, but in those cases, why not simply call a web service and then use js to update the ui without incurring in another partial postback?


If you do that can you use the updatePanel animation to notify the user that something is happening or do you have do it manually with js?


hello.

well, the updateprogress is really a wrapper around client behavior that is responsible for showing/hiding the contents you define. the upadteprogress is "tied up" with the partial postback model based on the server side approach.

nothing prevents you from doing something like this is js:

1. define the wait msg in an html element that has its display style set to no none

2. start the web service call and change the display of the element defined on 1

~3. handle the cb and error cb methods and make sure that you set the style of the element defined on 1 to none

yes, you do have to write some js code, but when you think about it, the J in AJAX stands for Javascript, right? :)


i am thinking to call the update panel after onload event using javascript. is there any idea how to call update panel using javascript.


hello.

well, the easiest way i've seen is to call __doPostBack and pass it the client id of the panel you want to update:

http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/


I just came accross a post where xr280xr says he acomplished exactly what you're trying to do using a timer.http://forums.asp.net/t/1176152.aspx


well, i'm sure that the timer has its uses, but if you just want to refresh the panel after the page has been loaded through js code, the link i've mentioned is the best option.


I'm happy to defer to your increased experience and knowledge on this, but can you explain why it would be preferable to go through the hassle of manually writing a JS function to do it as opposed to just using the timer as described in that post. I truly don't mean this in a rude way; I just don't see the benefit. Could you explain?


Luis,the link you provided is not working. would you please provide again.