Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Wednesday, March 28, 2012

Programmatic cascading dropdown repopulation

Greetings, all...

Time for yet another plaintive cry for help out to the Ajax community.

I've got a page with four cascading dropdown lists chained together. Everything is working fine.

Where my problem comes is when I add a new row into the database (via a web service) and now I want to call the parent dropdown list and repopulate it once I receive a success code from the ws. I want to be able to do this all via client-side, and I think (hope?) I'm close, but I just can't seem to get the ddl to update its options.

Here's the code so far. As you can see, I've been trying to tackle this two ways...using a $find().populate on the dropdownlist, and, alternatively, calling the web service directly. The web service call does, in fact, retrieve all the levels, including the newly added level, but I'm not understanding how to "bind" the results to the dropdown.

function AddNewLevel()
{
var txt = document.getElementById('<%= txtAddLevel.ClientID %>')
retVal = QuestionManagerWS.AddNewLevel(txt.value, OnAddLevelOk, OnTimeout, OnError);
return(true);
}

function OnAddLevelOk(result)
{
alert(result);
// This doesn't appear to do anything...it never calls the ws, etc.
$find('<%= ddlLevel.ClientID %>').populate;

// This calls the web service and gets the correct values...but how does it bind to the ddl?
//document.getElementById('<%= ddlLevel.ClientID %>');
//QuestionManagerWS.GetLevels("","Level");
}

Anyway, I would really appreciate any help that may be out there. I've looked at the stuff in the 'manual' folder of the ToolkitTests (there's usually a gem or two in there) but nothing gives any hint on how to get this to work.

Thanks in advance,

Ric

Does anyone have any ideas on this one? I'm still stumped and need some help.

I figured out a resolution to the problem.

I've blogged about it onmy site and in a few days will be putting together an article as an example to my solution.

Monday, March 26, 2012

Programmatically use PostBackAction

Does anyone have a sample on how to correctly use the PostBackAction? I am having a bear of a time passing the eventargument and eventtarget properly when using this programmatically. Thanks.

Jon

Did you ever find any examples? I think I might need to use PostBackAction and it would be nice to have an example.

Steve

Progressbar while the updatePanel is updating or the controls are rendering in the UpdateP

Hi Guyz,

Can anybody please tell me, how can i display a progressbar on the page with Ajax, which will stay there till the time data in the Updatepanel is loading. I have a gridview in a updatepanel which displays data from the database, it has paging enabled now what i want is when user changes the page. There should be a progressbar which says Loading ... or some message like that.

I have read some posts about UpdateProgress i think its not there in Ajax Beta 1 or 2. But there is UpdatePanelAnimationExtender.
But could not find anything useful. Is there any examples for this.

Can anybody please help.

Thanks
Amit

hi amit,

did u watched scott's video i hope it will help you. open this url in media playerhttp://download.microsoft.com/download/7/8/f/78f2d61a-74c6-47b6-835c-0d1efa5524af/ScuttGu_asp_net_atlas.wmv

or onhttp://ajax.asp.net see

Video - Developing ASP.NET 2.0 Applications using AJAX

by Scott Guthrie, General Manager, .NET Development Platform

at bottom of home page.

thanks,

satish.


Thanks satish

But its really easy with the help of updateprogress control. you can put the text you want to display while the updatepanel is updating. and that's it.

It will work for you.

Anyways thanks for your help again.

Amit


no worries amit. though lucky u working on AJAX its really wonderful but its not coming my way in my companySad.

regards,

satish.


i am just using prebuilt components, not doing my own programming with ajax.
It's really easy to use man. not a big deal.

Amit

Proper time to add UpdatePanel trigger

What is the proper time to add a trigger to an UpdatePanel from code-behind?

I currently have a control that acts as a NamingContainer. I am trying to have it register a couple of its buttons as async triggers if it senses that it is a child of an UpdatePanel. This is because these controls are databound (there are multiples of them in one UpdatePanel) so I cannot add the IDs of the controls declaratively.

I tried adding them in the PreRender phase of the control, but when I try it out I get a nasty exception on Render during a postback (below). I can only assume (from reflection) that initially, the triggers are being created when the controls are recreated from ViewState, then the controls those triggers reference get tossed aside when the list databinds after the change, so there's a null reference when the triggers from the first set try to find their real controls. However, I don't have any idea how to avoid this. Any help would be greatly appreciated.

Object reference not set to an instance of an object. 0.273490066474929 0.000559
at System.Web.UI.AsyncPostBackTrigger.HasTriggered()
at System.Web.UI.UpdatePanelTriggerCollection.HasTriggered()
at System.Web.UI.UpdatePanel.get_RequiresUpdate()
at System.Web.UI.PageRequestManager.ProcessUpdatePanels()
at System.Web.UI.PageRequestManager.RenderPageCallback(HtmlTextWriter writer, Control pageControl)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at IDM.Manage.UI.Page.Render(HtmlTextWriter writer) in C:\Projects\IDM.Manage\IDM.Manage\UI\Page.cs:line 39

I had this same problem when trying to add a trigger in the Page_Load.

It worked fine when I moved it to the Page_Init

Proxy Class generated at run time

Greetings,

as i know that the proxy class for the webservice is generated at run time ,but i am not understanding this concept because before i run my application i can access all the members(as methods) of this generated proxy class.

so i need to understand this topic?

your help is highly appreciated

best regards



Hi Wissam,

The proxy class indeed is created at runtime. When i look at my proxy this isn't possible. Are we talking about a javascript proxy?

Regards


Greetings,

i mean the proxy class when you add a web reference to the webservice.


Hi Wissam,

Yep when you create a webreference then you will be able to see the methods. The proxy isn't generated at runtime. The proxy is generated at design time. Hope this helps!

Regards,