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

Monday, March 26, 2012

catching the postBacks of UserControl inside another UserControl

My problem is that i've got:

MasterPage with a Menu, ScriptManager and a UpdatePanel, inside of wich i've put the the ContentPlaceHolder. I've put the Menu as trigger for the UpdatePanel

In the ContentPage i want to show, i have a UserControl that has inside of itself another UserControl.

Even putting an UpdatePanel in the ContentPage containing the UserControl (Parent), the whole page refreshes instead of been only the ContentPage, due to the UpdatePanel of the MasterPage.

All the UpdatePanels have de UpdateMode as Conditional.

How can i make this work, refreshing only the contentPage or the area pretended of the contentPage?

i've seen other Posts, but they only talk of one UserControl.

Thanks a lot.

You've got two problems:

First, the menu control is not compatible with partial-page updates and therefore not compatible with updatepanel controls.

Second, if you are using a master page, you are going to get a full refreshevery time you load a content page. When you navigate to a content page, you are not just reloading the part of the page that is in the contentplaceholder. You are loading anentire page that is a meshing of the master and content page. So what you are trying to do is not possible. Placing an updatepanel around a contentplaceholder does nothing. Different page = refresh.


thanks for your answer, but what i meant was the case of the usercontrols. the use of them makes me refresh the whole page, even though the content page is inside a update panel, i've tried to put the control inside a updatepanel conditional mode, but it still doesn't work.

this usercontrol was another one inside itself.


See if this article helps:

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

Catch async trigger in page_load

Hi guys,

I've recently started experiencing with the ASP.NET AJAX toolkit and I'm wondering if it's possible to catch the async trigger in the page_load and what object caused it?

This is in the situation that I have a lot of database accesses in the app. I want to be able to trigger really specific calls to the DB depending on if it's a postback, async call, etc. Not just a generic thing that's executed in the !isPostback section, causing the application to fetch a lot of data for a small AJAX call.

Thanks,

Ben.

if (ScriptManager1.IsInAsyncPostBack)if (ScriptManager1.AsyncPostBackSourceElementID == yourControl.ID){ // do your thang }

Awesome, thanks!

Ben.

Wednesday, March 21, 2012

CascadingDropDown needs to fire "SelectedIndexChanged" from client-side

It seems I always end up with more questions than answers...

So...here's the scenario this time.

I've got two dropdownlists, Make (ddlMake) and Model (ddlModel) with a CascadingDropDownExtender attached to ddlModel. Obviously, when the user changes the Make, I need to retrieve the appropriate Models based on the selection. No problem, that part works just fine.

The twist is this: When I load this up into a ModalPopup, a record is going to (pardon the pun) drive what's being populated into ddlMake. I'm using Javascript to .show() my ModalPopup after I've looked up the record, so the code goes a little like this:

function showModal(object)
{
var _ddlMake = document.getElementById("<%= ddlMake.ClientID %>");
var _ddlModel = document.getElementById("<%= ddlModel.ClientID %>");

// Dummy for now, will be pulled from the loaded record
_ddlMake.options[4].selected = true;
_ddlMake._onParentChange(null,null);

var _popup = $find(object);
_popup.show();
}


Some of the posts I've seen suggested the _onParentChange(null,null), but Firebug is barking saying "_ddlMake._onParentChange is not a function". Granted, it's one of the internals of the CascadingDropDown, but others have stated that this is the way to do it.

What I'm wondering is how to do this. I can't believe that I'm the only person to have ever thought of needing to set/fire these events from the client-side. I'd love some help on this one, that's for sure!

Thanks in advance,

Ric

Bump...still needing some help...

CascadingDropDown method error 500

Hi,

I've created a new project following the video found here :http://www.asp.net/learn/ajax-videos/video-77.aspx

My code is the same as in the demo, but when I run the website, I have the "method error 500" in each dropdownlist instead of the makes, models and colors...

Does anyone know what this error code means ?

Thanks for your help.

Hi Dpin,

10.5 Server Error 5xx
Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable of performing the request. Except when responding to a HEAD request, the server should include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. User agents should display any included entity to the user. These response codes are applicable to any request method.

10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

To resovle the kind of problem, we suggest that you should first check whether your WebService works fine or not. Then check the Control settings. If all these are ok, but your application doesn't work properly. Please add break points to your WebService and debug it step-by-step. Here is theuseful information. Please pay special attention to my last reply.

I hope this help.

Best regards,

Jonathan

CascadingDropDown load times with large amounts of data

Greetings,

I am a relative newcomer to ASP.Net AJAX. So hopefully the answer to this question will be quick and easy.

I've created a CascadingDropDown list that gets store locations based on the company. In some of these datasets there are as many as 6,000 - 10,000 records that need to be loaded into the TargetControl. This ends up being quite a lot of data. I was having problems with this origanally because of the default maxJsonLength in my webconfig which I've now corrected.

The TargetControl now gets loaded and it works with this one exception: For queries with exceptionally large datasets the client is taking up to 30 seconds or more to load the target control. I did caching on the server side in the webservice to cache data sets and that doesn't seem to be the problem. I've done some analysis with Fiddler v2.0 and it appears that the round trip request/response is taking only about a 5th of a second (see capture below):

Request Count: 1
Bytes Sent: 545
Bytes Received: 701,964

ACTUAL PERFORMANCE
-----
Requests started at: 13:58:38:1621
Responses completed at: 13:58:38:3496
Total Sequence time: 00:00:00.1875024

RESPONSE CODES
-----
HTTP/200: 1

RESPONSE BYTES (by Content-Type)
-----
~headers: 239
application/json: 701,725

So the question is: why does it take the CascadeDropDown control so long to load the data? What is client doing for the other 29.8124976 seconds?

When I did this web app in ASP.Net 2.0 (without AJAX), it was taking 2- 3 seconds max for these large data sets to load doing direct databasecalls.

Any help would be appreciated.

Thanks,

Scott Lance
Application Developer
Children's Miracle Network

I have the same problem in my application. Large sets of data are not uncommon in the large applications.

Can anybody, please, take a look at this

CascadingDropDown in a composite control with Page Level Webmethod

I want to build a CompositeControl with a CascadingDropDown and use the Page Level Webmethod trick. I've built the control and if I put the webmethods directly on the page that uses the control, everything work great. However, this control will be used on several different pages in the app and it doesn't seem right to have to duplicate the webmethods on each of the pages. I tried adding the webmethods to the composite control but that didn't seem to work. Any ideas how to make it work?

Thanks

Hi Birch9373,

Please seperate the PageMethod from the MasterPage to an individual WebService(.asmx).Then set its ServicePath and ServiceMethod for the CascadingDropDownExtender in the MasterPage. It won't work in your situation.

Best regards,

Jonathan


Jonathan,

Thanks for the response. Do you know of a good article that discusses how the internals of how the Page Level Webmethod works?


Hi Birch9397,

Please see these documents,Exposing Web Services to Client Script in ASP.NET AJAX andWebService.

Best regards,

Jonathan