Showing posts with label ive. Show all posts
Showing posts with label ive. Show all posts

Wednesday, March 28, 2012

Very long loading times on II7 free hosting sites

I've deployed a recently started project on 2 IIS 7 free hosting companies, hostmysite.com and maximumasp.com.

I have encountered big loading times on the whole site, but mostly at AJAX parts. For example I have a few cascade drop down lists and it takes 2-3 seconds to populate 1 dropdown with 3-4 listitems when the user selects something in the first dropdown. On my localhost it happends faster than you blink (E6660, 2 GB RAM).

Have anyone tried out this services ? Its their fault for the big loading times or maybe it's something from my code ? I'm really worried about this and I have no other testing option except this free hosts.?

Well, how does it run for you in development?

You really need to look at what's slow. Is it your app or is the Internet Connection? Is it latency (ie. startup of the app) or is it request times that are slow.

Hosting sites often have issues with very short Application Pool timeouts that cause the entire app to shut down and are then slow to restart. However, this should not be an issue if you use the site for a number of hits in a row.

+++ Rick --


I'd recommend you first use something like FireBug (or the IE equivalent) to monitor the network traffic your partial postbacks cause. It sounds like the network traffic is your bottleneck. Especially watch out for huge ViewStates that get uploaded with every partial postback.


On developing machine it's instant.

I used firebug to do some texts on a page. I have 2 dropdown lists in an update panel and below (outside the update panel) I have a huge gridview. The problem seems to be that gridview's huge viewstate that gets uploaded/downloaded with every partial postback asgt1329asaid.

Now I know the problem. But whats the solution ? Why does the gridview's view state gets uploaded/downloaded everytime even if the gridview is not inside the update panel ?


Unfortunately, the full page's ViewState is sent back and forth on any partial postback. There's no way around that. Though, most of the time there are controls that you can disable ViewState on to minimize it. Or, if you're doing a lot of postbacks, you might consider rebinding controls on the server side, instead of using ViewState to persist them (viability of this really depends on how your page works).

The other option is that you can use web methods/services to replace some of your heavily used UpdatePanels with JSON communication:

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


Thanks for all the possibilities you recommended me.

Knowing almost nothing about them all I would also like a suggestion about what method to use. I'm trying to make minimize partial postbacks times because 3 seconds for populating a dropdown list with 5 items it not an acceptable time at all.

Using Web Services seems to most suitable method, but as I said, I know almost nothing about them all so I would like to hear an opinion from someone who knows more than me.


You should attempt to do both. Optimize your ViewState and replace partial postbacks with leaner alternatives when it's possible.

Most controls that are based on form elements can have ViewState eliminated. This is beneficial, even in non-AJAX scenarios, but will especially help cut down on the network footprint of your partial postbacks.

Web Method/Services are great. However, you can't (realistically) use them for anything that needs to modify ViewState. I'd say they're especially well suited to read-only operations that display changing data. A stock ticker, for example. On the other hand, manipulating a GridView with Web Methods would be tough. For more info on web methods vs. UpdatePanels, take a look at this:http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/

Also, don't forget the AjaxToolkit. For your dropdown, you could use the cascading dropdown extender in the toolkit to do half the work for you (just need to make the web service for it and you're done).


Allright I've used cascadeDropDown extender for my 2 dropdowns and wrote a WS to handle them. The problem is now that depending of the selection I make in the first dropdown I also want to display or hide a label or change it's Text value. This cannot be done within the WS so I'm back to where I started.


I believe those dropdown extenders fire the normal client side events. So, you could handle EndRequest() to change cosmetics like a text label or div visibility on the client side (or do it on BeginRequest, if you wanted).

Basically, if it's a read-only, cosmetic change, try to do it in client script if you can.


If you are looking for super lightweight grid which support binding data from a web service call try thishttp://dotnetslackers.com/articles/ajax/ASPNETAjaxGridAndPager.aspx


Could you please detail this gt1329a ?

VERY new to asp.net AJAX: Enabling controls based on slection from AutoComplete control

I've been reading all day and I'm not finding the solution to my requirement.

I'm developing a form to enter "lead" information, part of the lead data is the name of their Dr. We maintain a MySql DB with leads and Drs information.

When a user is entering a new lead and they type the last name of the Dr I have a AutoCompleteExtension fetching Dr.s that match the last name. When/if the user selects a Dr. from the list I want to DISABLE the other Dr. related fields (FName, address, etc) and insert the data from the selected Dr. If there is no match found, the user will enter the details for the Dr. (new record).

The main issue I'm struggling with is how to respond (client or server) to the user making a selection from the AutoComplete list and enable/disable and populate the related fields. For example, the user picks a Dr. from the list, I then want to disable all the Dr. detail related fields and set the values with the record from the database.

I'm not sure how I will accomplish this yet, I imagine I would need to set those values from the server side and it would in turn use AJAX to push the values down to the client?

If anyone could give me a little guidance I would really appreciate it, I just need a jump start to get this thing going.

Thanks for reading,
Steve


If you're Textbox that has the AutoComplete extention on it loses focus, why not use the onBlur event to check to see if they used your AutoComplete (which would have text in that textbox). If they did use the AutoComplete, then use JavaScript to disable the other textboxes.


You could use the ItemSelected event of the AutoComplete extender in the client and as RTernier says use JavaScript to disable the other textboxes, you could call a webservice to obtain the remaining information of the doctor, check: http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx
http://www.asp.net/ajax/documentation/live/tutorials/EmbedScriptFile.aspx For information on using WebServices. You could also use an UpdatePanel, I guess you could call a partial post back from the ItemSelected event, although I'm not an expert in UpdatePanel, but I think it would work (personally I like the webservice way better, but it's a matter of choice).

very very simple question about $get

in javascript how can I transform this :

var texte=document.getElementById("Text1").value;

with a $get ? I've tried var texte=$get("Text1","value"); but it doesn't work ?

I'm on Vista with VS 2008 RTM

Thanks

Try var texte=$get("Text1").value, basically $get() is a shortcut to document.getElementById()

Hope this helps,

Elias.


thanks it works, I was waiting for intellisense, but $get(tytu). there is no intellisense.


Keep in mind that $get is exactly the same as getElementById. They both return a reference to the supplied DOM element. $get is just a shortcut, to save typing and improve readability.

If you have existing code using getElementById, you don't have to convert it to $get unless you want to.

Monday, March 26, 2012

Visual Studio 2005 Installation Question?

Greetings. I'm not exactly sure where to post this question so I apologize if this is the wrong place.

I've just started working with ASP.net AJAX and the Toolkit. I have had success getting my environment all setup and have successfully created a page with a slideshowextender.

Thing is, I must not have done something right because even though everything appears to work, I get the red squiggly line under anything AJAX or Tooklit related in source mode in Visual Studio 2005 Pro. I basically followed the instructions on setting up the environment on the Toolkit demo page after installing the AJAX extensions. I then followed the instructions in some of the Toolkit demonstration videos to get everything else working.

Just wondering if there's a step I missed in order to make VS2005 understand what all the new controls are. Any tips would be appreciated.

Jim Sparks

Hi Jsparks,

jsparks:

Thing is, I must not have done something right because even though everything appears to work,

Do you mean the SlideShowExtender works as your expect?

If not, we suggest that you should check yourweb.config settings. Also you should check whether the ASP.NET 2.0 Ajax Extensions V1.0 and Ajax Control Toolkit works properly or not.

I hope this help.

Best regards,

Jonathan

Void System.Web.UI.ScriptManager.RegisterHiddenField(

I've see this posted here by others and I'm getting the same thing with the samplewebsite and anything I do in a new project. I must have the latest vesions because I just downloaded them Sunday.

Gary

Can you please paste in the full error message...not enough info in the title.


Server Error in '/SampleWebSite' Application.
------------------------

Method not found: 'Void System.Web.UI.ScriptManager.RegisterHiddenField(System.Web.UI.Page, System.String, System.String)'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: 'Void System.Web.UI.ScriptManager.RegisterHiddenField(System.Web.UI.Page, System.String, System.String)'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[MissingMethodException: Method not found: 'Void System.Web.UI.ScriptManager.RegisterHiddenField(System.Web.UI.Page, System.String, System.String)'.]
AjaxControlToolkit.ToolkitScriptManager.OnLoad(EventArgs e) +0
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061


------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210


I just replaced the toolkit with the new one uploaded 6/18. It no longer is getting the missing method error however, the DropDown (the one that I was most intrested in) no longer works right on the sample website nor in my own project: The dropdown doesn't show.

Gary


Hi Gary,

Do other controls work fine? Did you see any javascript error?


This got solved on another thread. Turns out my ajax 1.0 wasn't the latest but works fine after getting the latest.

Thanks to all.

Gary

Saturday, March 24, 2012

Way to hold state of collapsible panel?

I've created a website application with a MasterPage that has an Accordion side-menu contained in a Collapsible Panel. It works fine, however, I need a way to hold the state of these controls when the user is redirected to another page.

So, if they have the side-menu collapsed and click a link to another page, when the new page is displayed, the side-menu should remained collapsed...is there anyway to do this? Basically, I just need to set some Session Variables to hold the state whenever the user manipulates the side-menu...

You could probably do it in viewstate? I don't have time to test it out right now, I'll try to get back to this later if nobody else has answered. Basically after you open a collapsible panel you could set something like viewstate("thiscontrolisCollapsed")=false and then on the page load you could do something like

if viewstate("isCollapsed")=false then

' code to open panel

end if

just off the top of my head. Sorry I can't be more technical with it, I'm getting ready to walk out the door and thought I'd throw this out as a suggestion.


Thanks, but the problem is actually being able to hold the state of the collapsible panel on the server side. All the collapsing and expanding is handled in client side javascript, and I'd need to somehow run some server-side code to hold the state after the client script has expanded or collapsed the panel.

I was thinking I need to fire off a client side call-back, but I can't figure out how to trigger it when the collapsible panel is expanded or collapsed...


Ok, I've figured out how to accomplish this. I already had an image that was the ExpandControlID and CollapseControlID, that the user clicks on to expand or collapse the panel. So I simply added an onclick attribute to that image which calls a javascript that initiates a client side call-back, where I pass the Collapsed status of the panel to the server and set a session variable. My code is below:

<script type="text/javascript" >
function holdSideMenuState(){
holdSideMenuStateInSession(!$find("SideMenuBehavior").get_Collapsed());
}

function sessionNowHoldsSideMenuState(isSideMenuCollapsed, context){
alert(isSideMenuCollapsed);
}
</script>
<table border="0" cellpadding="0" cellspacing="0" class="SideMenu">
<tr>
<td class="SideMenuExpandCollapse" valign="top">
<asp:Image ID="imgExpandCollapse" runat="Server" ImageUrl="~/images/collapse.jpg" CssClass="ExpandCollapseImage" />
</td>
<td>
<asp:Panel ID="pnlSideMenu" runat="Server">
Side Menu Content goes here....
</asp:Panel>
</td>
</tr>
</table
<ajaxToolkit:CollapsiblePanelExtender ID="cpeSideMenu" runat="server"
TargetControlID="pnlSideMenu"
CollapsedSize="0"
Collapsed="False"
ExpandControlID="imgExpandCollapse"
CollapseControlID="imgExpandCollapse"
AutoCollapse="False"
AutoExpand="False"
ScrollContents="False"
ImageControlID="imgExpandCollapse"
ExpandedImage="~/images/collapse.jpg"
CollapsedImage="~/images/expand.jpg"
ExpandDirection="Horizontal"
BehaviorID="SideMenuBehavior">
</ajaxToolkit:CollapsiblePanelExtender>


protected void Page_Load(object sender, EventArgs e)
{
string callBackReference = Page.ClientScript.GetCallbackEventReference(this,"isSideMenuCollapsed","sessionNowHoldsSideMenuState","context");
string callBackScript ="function holdSideMenuStateInSession(isSideMenuCollapsed, context){" + callBackReference +"}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"holdSideMenuStateInSession", callBackScript,true);

imgExpandCollapse.Attributes["onclick"] +="holdSideMenuState();";

if (!IsPostBack)
{
if (Session["IsSideMenuCollapsed"] ==null) Session["IsSideMenuCollapsed"] =false;

cpeMenu.Collapsed = Convert.ToBoolean(Session["IsSideMenuCollapsed"]);
}
}

public void RaiseCallbackEvent(string isSideMenuCollapsed)
{
Session["IsSideMenuCollapsed"] = isSideMenuCollapsed;
}

public string GetCallbackResult()
{
return Session["IsSideMenuCollapsed"].ToString();
}


I have some more work to do because in my real code, I actually have an Accordion inside the collapsible panel, and I need to hold the state of the accordion as well, but I'll save any questions I have with that for another thread...

WCF AJAX Enabled Service and looping through Dictionary<string,string>

I hope someone can help me on this. I've tried every sample and cant seem to figure it out. I'm returning a Dictionary<string,string> from a WCF Service using Visual 2008 with .Net 3.5.

public Dictionary<string, string> RetrieveNavigationStylesLists()
{
Dicationary<string,string> data = null;

...

data = new Dictionary<string, string>();
data.Add("StyleID", styles[loop][0].ToString());
data.Add("Style", styles[loop][1].ToString());
data.Add("Default", styles[loop][2].ToString());

return data;

}

in my javascript i've tried the following:

...
// WCF Service is invoked an on success calls the function below

function onNavigationSuccess(args)
{
for(var data in args)
{
var key = data;
var keyValue = args[data];

}
}

But when i loop through the data i get only

loop 1:
key = 0
keyValue =
-key = "StyleID"
-value = "2"

loop 2:
key = 1
keyValue =
-key = "Style"
- value = "Page Title"

I cant seem to get the key name or the key value

If i look at args is contains the following data:

args = [0]
which has key="StyleID" and value="2"
[1]
which has key="Style" and value="Page Title"
[2]
which has key="Default" and value="False"

I've tried every sample that is available but cant seem to get it to work

Thanks




check this hope it helpshttp://wiki.freaks-unidos.net/javascript-libraries

Wednesday, March 21, 2012

Web Form & AJAX Control Toolkit

Hi,

I'm new to ASP.NET AJAX, and I have a few questions.

Can I use the AJAX Control Toolkit on a ASP.NET Web Form? I've tested the controls on the "ASP.NET AJAX-Enabled Web Site" template and they work fine there, but on a web form there's no action.

If its possible, what I must do to enable AJAX on a web form and/or a user control?

Thank youYes

cseven:

Can I use the AJAX Control Toolkit on a ASP.NET Web Form? I've tested the controls on the "ASP.NET AJAX-Enabled Web Site" template and they work fine there, but on a web form there's no action.

If its possible, what I must do to enable AJAX on a web form and/or a user control?

Peace be unto you,

In case of using Asp.net AJAX in web application or website other than AJAX Enable, you need to write following lines under system.web in web.config

 <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>

If it works let me know ... cheers


Thanks, works like a charm.

I knew that the solution had to be on the Web.Config file.Big Smile

Back to work!

Thank you againYes



cseven:

Back to work!

Thank you againYes

It is glad to know that your work is done, Please pray for me.

web service call failed: 500 using ajax hovermenu and web service

Hi there,

I'm using a hovermenuextender attached to a templatefield of a gridview, and everything seemed to work fine.. however I've moved on to add dynamic attributes to the hovermenu. Now I get the error "web service call failed: 500" in place of the output I want (on the hovermenu's panel).

When accessing the web service I created (directly through the browser) everything works fine..

here's my hovermenuextender dynamic attributes

DynamicContextKey='<%=eval("refnumber") %>'

DynamicServiceMethod="GetSearchDetails"

DynamicServicePath="Services.asmx"

DynamicControlID="lbdynamiccontent"

I've done a bit more fiddling.. so this extra info may be useful.. it may not (I've only just started playing with this).. using firebug, I can see the response to the post to the webservice fails with "Invalid web service call, missing value for parameter:".. I tried swapping my service for the helloworld one, and that works fine! Why is my parameter not being sent? I was thinking the parameter is the dynamiccontextkey - is that correct?

Any help would be greatly appreciated! I also saw error 12030 instead of 500 crop up, but that seems to have gone (!!!)

cheers, Chris

Hi,

I fail to reproduce the issue. Can you show me more of your codes?


i think you are using the DynamicPopulate instead of Hovermenu. In that case i think you should check its documentationhttp://ajax.asp.net/ajaxtoolkit/DynamicPopulate/DynamicPopulate.aspx. Basically i think you are having passing the contextKey in the WebService, can you pls check if the db field is not null or it contains some value.