Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Wednesday, March 28, 2012

Changing dynamically a user control within an UpdatePanel

I have a page that (using ajax), will dynamically route someone through a bunch of survey questions. Each survey page is written as a user control as each page needs to have a lot of flexibility, etc to visually add/edit HTML, blah, blah, but that's not the problem. I'm having a problem with loading the question too late in the page life cycle, so our respondent will see the following...

Introduction, Q1 (where they answer), Q1 again (as their answers aren't remembered), Q2 (Q1 answers were remembered this time), Q2 (again, cause Q2 answers weren't remembered first time again)... and so on, etc.

I know what the problem is, but I'm drawing a blank on how I can execute what I want properly. I've attached the code for my controlling page below. Thank you for any advice anyone can offer!!!

<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/survey.master" Title="Surveys" %>
<%@dotnet.itags.org. Import Namespace="SurveyWebControls" %><script runat="server">
const string SurveyStart ="SurveyStart";

SurveyPageBase currentSurveyPage;

protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme ="SurveyDefault";
}

protected void Page_Load(object sender, EventArgs e)
{
lblErrorMessage.Text ="";

if (txtCurrentSurveyPage.Value =="")
LoadSurveyPage(SurveyStart);
else LoadSurveyPage(txtCurrentSurveyPage.Value); }protected void btnNext_Click(object sender, ImageClickEventArgs e)
{
if (currentSurveyPage.Validated)
LoadSurveyPage(currentSurveyPage.NextPage);
else lblErrorMessage.Text = currentSurveyPage.ErrorMessage; }private void LoadSurveyPage(string QId)
{
Survey.Controls.Clear();
currentSurveyPage = (SurveyPageBase)LoadControl(QId +".ascx");
Survey.Controls.Add(currentSurveyPage);
txtCurrentSurveyPage.Value = currentSurveyPage.QId;
btnNext.Visible = currentSurveyPage.ShowNext;
}

</script
<asp:Content ID="SurveyBody" ContentPlaceHolderID="SurveyBody" Runat="Server">
<asp:UpdatePanel ID="SurveyUpdatePanel" runat="server">
<ContentTemplate>
<asp:HiddenField runat="server" ID="txtCurrentSurveyPage" />
<asp:Label runat="server" ID="lblErrorMessage" SkinID="ErrorMessage" />
<asp:PlaceHolder ID="Survey" runat="server" />
<br /><br />
<asp:ImageButton ID="btnNext" SkinID="NextButton" runat="server" OnClick="btnNext_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Try to use the template of asp:Wizard to load?user?controls?dynamically.?Try?to?take?a?look?at?the?following?materials?for?details.
http://msdn2.microsoft.com/en-us/library/fs0za4w6(VS.80).aspx
http://aspnet.4guysfromrolla.com/articles/061406-1.aspx
http://support.microsoft.com/kb/180405
http://weblogs.asp.net/sushilasb/archive/2004/03/31/104939.aspx
http://aspalliance.com/766_Working_with_the_Wizard_Control_Using_Visual_Studio_2005

Wish the above can help you.
I had thought of that, but it would still have to be dynamic. Sometimes there are literally hundreds of pages where someone might only go through 5 of them, based on how they answer previous questions.

changing button values on a tab

I have a AsP.net,VB.net app using tabs and I have two buttons at the bottom of the page that i want to change everytime the user goes to the next tab.

IE: btnBack and btnProceed, when you go to page two I want to change the image URL to be imageButtonBackToPage1 and imageButtonProceedToPage2 and so on, hope you get the idea.

Anyways, there are two ways for the user to go through the pages, 1 is using the tabs and 2 is using the buttons.

when the user uses the buttons i am able to change the imageurl easily but when the user uses the tabs nothing fires so I want to change the imageURl for the new page and saw that OnClientActiveTabChanged can find the active tab but I need a good example (of javascdript and HTML) of how to use this because I want to find out the active tabe and change the button images according to that.

Does anyone have good examples of how to do this? thanks.

Hi!

You could fire a post-back on Tab click using the following function, and setting the OnClientActiveTabChanged event toOnClientActiveTabChanged="ActiveTabChanged"

<script type="text/javascript">
function ActiveTabChanged(sender, e)
{
__doPostBack('<%= TabContainer1.ClientID%>', sender.get_activeTab().get_headerText());
}
</script>

Then, on code behind, use the TabContainer_ActiveTabChanged to change any values for the buttons.

Hope this helps,


thanks, what is the syntax for aclling ActiveTabChanged in the aspx page (what do you pass for sender and e?

Also, I am doing this with Ajax so I dont think the postback will work.


Hi,

Just scroll down the events drop-down list on VS 2005 and select ActiveIndexChanged on the TabContainer Control, then use the ActiveIndex or the ActivePanel properties to apply any code you need.
On server side you are not catching the javascript function, just using it as a trigger.

Why the post-back wouldn't work because AJAX? It's just firing an event which otherwise doesn't get fired by default. You can put your TabContainer inside an UpdatePanel and set the TabContainer_ActiveIndexChanged event as a trigger and you won't notice the difference. I'm using this approach and it works perfectly.


Thanks, this helps greatly, i am still learning Ajax. if you can post any sample code that would be great. thanks for your help, this saved me a lot of time.

Hi! You're welcome!

Just post your code and let us know where you are stuck, but basically is something like:

Protected Sub TabContainer1_ActiveTabChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabContainer1.ActiveTabChanged
If TabContainer1.ActiveTabIndex = 0 Then
Button1.ImageUrl = "YourPic"
ElseIf TabContainer1.ActiveTabIndex = 1 Then
Button2.ImageUrl = "YourPic"
End If
End Sub


thanks, almost there, one thing I noticed is that I had to set AutoPostBack=true for the TabContainer and now its capturing the event in the vb.net code. I thought I would be done with this task now but a funny thing is when I switch from tab to tab now its not changing the button images (i have code just like you wrote in your last post there) so I am really puzzled now, please let me know if any of you have any ideas. thanks.


Hi!

That's not a problem, just put your buttons inside UpdatePanels and call UpdatePanel.Update() from the TabContainer.ActiveIndexChanged event, or set the button's UpdatePanel triggers accordingly.


Thats it! thanks much, it works great now!


Hi! Well, I'm glad it helped!

Could you please mark the post answered to close the thread?

Cheers,

Change TimerControl Interval property without postback

Hi,

I have a "Live monitor" scenario, where data in UpdatePanel is being updated on TimerControl tick.

I want to give user an ability to change interval. It works fine, but postback is needed to do so.

Any way to do it without a postback?

(I'm new to atlas, so please excuse me if it's obvious.)

hello.

well, if you're ready to build your own timer, then it's possible to do that in the client side. currently, the problem is that the timercontrol generates a client behavior but doesn't generateou an id. due to this, you cannot get a reference to the behavior in the client side and do need to do a postback to refresh that interval.

Change the default async timeout error message

I can't believe this question hasn't been asked before... How do I change the message that is displayed to the user when an async postback has timed out? I've searched the scriptmanager documentation and tried to handle the asyncpostbackerror or whatever event (which doesn't fire on a timeout), but I can't figure out how to do it. Any hints will be appreciated. Thanks.Hi,

You can add your own error handler as the following code:
function StartAsyncPostBack() {
WebService.set_timeout(2000);
WebService.RunForLongTime(0, Complete, OnError); // call a method with the signature of?RunForLongTime(int);
}
function OnError(result) {// your error handler
alert("error: " + result.get_message());
}

Hope this helps.

Change textbox css class onfocus

I'd like to have a textbox that changes css classes (bgcolor primarily) when the user is typing in the box (onfocus). I'd also like to have the textbox validated onblur and if the textbox is invalid change css class again.

I've accomplished all of this using maskededit and maskededitvalidator, however for a basic string entry such as a name I don't want any mask characters to be used in the textbox. My app will be used by very computer illiterate people, and I'm pretty sure having the ____ in the box or even having spaces will cause a lot of confusion and trouble so I would like to avoid that.

What is the best way for me to accomplish this? Also FYI, I'm a former ASP/javascript developer trying to make the move to .net.

Your best bet is to register a .js file in your scriptmanager's Scripts collection.

In that .js file, create a function called pageLoad() (the framework automatically wires that for you to fire when all the other html elements and ajax compoennts are done loading).

In your pageLoad function add an event handler to your input control like so:

$addHandler($get('inputControlId'),'focus',handler);

handler is the name of a function that you define next.

function handler(ev){
Sys.UI.DomElement.toggleCssClass(ev.target,'onfocusclassname');

}

where 'onfocusclassname' is defined in your CSS document as the style you want applied to the control when the control has focus.

Hope that helps.


That helps a ton, that's basically what I wanted to do I wasn't sure exactly how to do it. And am still not 100% sure, such as where i register this .js file, but I can probably figure that out. I assume I would then make a 'blur' handler as well.

paul.vencill:

$addHandler($get('inputControlId'),'focus',handler);


Do I need to do this for each textbox? inputControlId appears to be hardcoded. I want to have this functionality for all text boxes in an application, which will be hundrerd of textboxes once all the pages add up.

And I guess I would have to write my own client side validation functions then, in order to make the text box red after an invalid entry.


Well, there's a number of ways to skin any cat, of course. First, your questino on registering; the way I prefer to do it is to use the scriptmanager on the page:

<asp:ScriptManager id='scm' runat='server'> <Scripts> <asp:ScriptReference Path='myscript.js' /> </Scripts></asp:ScriptManager>

Like any control, you could also register it in the codefile, your choice.

As for your question on the volume of handlers you need to add, the $addHandler function requires as its first parameter a reference to a DOM element (hence using $get('id'); which returns a reference to the element itself). If you want all your text inputs then use document.getElementsByTagName() and then filter inside a loop like so:

var inputs = document.getElementsByTagName("INPUT");var count = inputs.length;for (var i=0;iif(input.type && input.type.toUpperCase() =='TEXT') $addHandler(input,'focus',handler);}

Now, for extra fun, if you want to add both a focus and a blur handler to the same object, then instead of $addHandler you can use $addHandlers (with an 's'). It's a convenient shortcut: int he above function change the $addHandler line to:

$addHandlers(input,{'focus' : focusHandler, 'blur' : blurHandler});

As for adding your own validation; yes, I'd submit that it'd probably be easier than trying to get the validation controls to play nicely with your custom script. Just make sure to validate on the server, too, to catch values from clients that have javascript disabled.

Change datasource for a datagrid using ajax

Hi ppl,

I have a datagrid with XML's as a source file. I have a combo box in the same page and when a user selects a value from the combo box i want to display different stats data without doing a normal postback. I am still learning the updatepanel Ajax control . Can anyone please guide me what i should i do to achieve the functionality? do i need to write any function in js ?

Any help much appreciated

thanks

Place the UpdatePanel around the DataGrid and the Combobox. Make sure the combobox do a postback, set the Autopostback attribute to true. Hook up to the OnSelectedIndexChanged event and get the data based on the selected value and bind it to the DataGrid. When a control inside a UpdatePanel will do a postback, the content of the UpdatePanel will be updated.

If you layout of you page don't allow a UpdatePanel around your combobox, you can instead add a async. postback trigger to the UpdatePanel that will listen to a control's event and update the panel.


Hi Thanks for the response. I placed as the gridview control in the updatepanel and used async trigger as you mentioned. when i changed the dropdownlist the grid doesnt appear at all.

Here is the script and code:

<

divID="Panel1"style="width: 568px; position: static; height: 180px; background-image: url(images/bg-nav.png);">

<spanstyle="color: #ffffff"><strong>

Select L :

</strong></span><asp:DropDownListID="DropDownList1"runat="server"Width="134px"AutoPostBack="True"OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged1"><asp:ListItemSelected="True"Value="1">yes</asp:ListItem><asp:ListItemValue="2">no</asp:ListItem></asp:DropDownList><br/><asp:UpdateProgressID="UpdateProgress1"runat="server"AssociatedUpdatePanelID="test"><ProgressTemplate><divstyle="color: #ffffff; background-color: transparent"><imgsrc="images/indicator.gif"/>

Updating ....

</div></ProgressTemplate></asp:UpdateProgress><asp:UpdatePanelID="test"runat="server"><ContentTemplate><asp:GridViewID="GridView1"runat="server"ForeColor="Silver"BorderColor="LimeGreen"BorderStyle="Inset"AutoGenerateColumns="True"><AlternatingRowStyleBackColor="LightSkyBlue"ForeColor="#404040"/></asp:GridView></ContentTemplate><Triggers><asp:AsyncPostBackTriggerControlID="DropDownList1"EventName="SelectedIndexChanged"/></Triggers></asp:UpdatePanel>

Code:

ProtectedSub DropDownList1_SelectedIndexChanged1(ByVal senderAsObject,ByVal eAs System.EventArgs)If DropDownList1.SelectedValue = 1ThenDim myDataSetAsNew DataSet()

myDataSet.ReadXml(Server.MapPath(

"test1.xml"))

GridView1.DataSource = myDataSet

GridView1.DataBind()

ElseDim myDataSetAsNew DataSet()

myDataSet.ReadXml(Server.MapPath(

"test2.xml"))

GridView1.DataSource = myDataSet

GridView1.DataBind()

EndIf

EndSub

When i give wrong XML File name, it comes up with the message saying that it cant find the xml file. Is it something i missing in grid control?

Any help much appreciated?


I copied your code, created 2 example XML files, and everything worked fine for me. When I select a value the GirdView was displayed with the correct XML file.

Hi Fredreik

Can you post your sample XML files? I tried using without AJAX functionality and its working fine :(

thanks


I can't think it has anything to do with your XML files, btw do you use the ASP.Net Ajax version 1.0 RTM, becuase your code runs on my machine with no problems at all so I can't see why it shouldn't work on yours.. maybe you have some more code that I don't have.. I only copy the code you posted.. mabye you do something in code-behind etc..!?

Change CollapsiblePanelExtender properties programatically within a DataList

I'm currently using CollapsiblePanelExtender within a DataList. The DataList contains a Label where the user will select to expand/contract theCollapsiblePanelExtender. TheCollapsedproperty withinCollapsiblePanelPropertiesis set tofalse. I would like to expandonly the first panel in the DataList when the page loads while the remaining panels remain collapsed.

I am intending to set theCollapsiblePanelPropertiesto true for the first item in the DataList within the DataList1_ItemDataBound event. How do I reference theCollapsiblePanelProperties as it does not contain an ID likeCollapsiblePanelExtender as I can not perform the following?

CollapsiblePanelProperties cpp =newCollapsiblePanelProperties();

cpp = (CollapsiblePanelProperties)e.Item.FindControl("CollapsiblePanelProperties");

Is there a different approach? Thanks in advance.

This has come up a couple of times in the past few days. A good solution when it works is something like "Extender1.GetTargetProperties(Control1)". I think that will work here, so please give it a try!

Thanks David. Extender1.GetTargetProperties(Control1) works!

Control1 being the TargetControlID of the CollapsiblePanelProperties. In my sample, Control1 is Panel1. Here is the code within the DataList1_ItemDataBound event for everyone...

if

(e.Item.ItemType ==ListItemType.Item){ CollapsiblePanelExtender ce =newCollapsiblePanelExtender();

ce = (

CollapsiblePanelExtender)e.Item.FindControl("CollapsiblePanelExtender1"); Panel pan =newPanel();

pan = (

Panel)e.Item.FindControl("Panel1"); if (e.Item.ItemIndex == 0){ CollapsiblePanelProperties cpp;

cpp = ce.GetTargetProperties(pan);

cpp.Collapsed =

false;

}

}

Monday, March 26, 2012

centered update progress

Hi;

I usually have my update progress control on the top of the page but on long pages, the user can't see it.

On codeplex.com, when i insert some text on "Search Projects" (upper right) and hit the search button, an "Updating" message is showed on the center of the page and the rest of the page becomes gray. Can i get this same result using AJAX update progress?

Thanks in advance;

If that is what you want, you should probably use the ModalPopup control. Try it at: http://asp.net/AJAX/Control-Toolkit/Live/ModalPopup/ModalPopup.aspx


Pls checkout this link, it got some cool example of Moal Popup extenderhttp://mattberseth.com/blog/modalpopupextender


See this link for AJAX Progress bar in the middle of page

http://www.ajaxium.com/ajax-for-asp.net.aspx

Causing Async Postback after closing ModalPopup

Hey,

Im trying to make use of the ModalPopupExtender in order to allow the user to input some information and then have an UpdatePanel async postback to update with this new information. The key here would therefore be to Update the Panel right after closing the ModalPopup. This is where Im having some troubles. No matter what I cant get the UpdatePanel to postback after clicking Ok from the ModalPopup. As of right now, once you click Ok from the Modal, you have to hit refresh in order to see the results of the info... which kinda defeats the purpose of AJAX.

Thanks in advance for help!

Hi,

You can first add an invisible button on the form, and set it as the triggerfor the UpdatePanel.

Then, add a OnOkScript to the modalPopupExtender. In the script, call click on the invisible button. Like this: $get("id of the invisible button").click

So, whenever the modalPopup is closed via clicking on ok button, the UpdatePanel is able to update.

Hope this helps, and please feel free to let me know if there is any problem.

Cascasding Drop Down Page method custom variable

Hi

I have page method populating the first of my drop downs and the reason being is that i need a variable that will be specific to user.
Currently this is stored in the session...How can i use this variable in the Page Method that is static...I cant really use a static variable as they are shared between all users.

Thanks.

Steve

Hi Steve,

Unfortunately I don't know of a good way to do this anymore. When we first wrote CascadingDropDown page methods weren't required to be static so there was an easy solution. Could you create a work item on CodePlex for this? Perhaps we could modify the web service signature to include optional tag info.

Thanks,
Ted

AAAAAHHHHH!!!!!

Well i have found a solution that works for me and may well for others.....
I have a web method that has Sessions enabled that i can call to get the value from...of course this method cannot be on the page as Sessions arent static.

[

WebMethod(EnableSession =true)]
publicCascadingDropDownNameValue[] GetDivisionsBySessionIdAccount(string knownCategoryValues,string category)
{
SessionCollection oSC; if (Session["UserObj"] !=null) {
oSC = (SessionCollection)Session["UserObj"];
// Calling another method to get my array - the same one i used from the page method.
CascadingDropDownNameValue[] retArray = GetDivisionsByIdAccount(oSC.idAccount);
return retArray;
}
else {
thrownewException("Your Session Has Expired");
}
}

I have created a work item number7579 for this.

---

I have just updated to the release toolkit and now my CCDD have stopped working! The top drop down loads fine from the method above but none of the others below. I have a debug error in jsSys.Debug is null or not an object.??

ARGH!


Here's more on the typical cause of Sys.Debug is null:http://forums.asp.net/thread/1546990.aspx

Wednesday, March 21, 2012

CascadingDropDown question

I have weird problem with CascadingDropDown. I have user control with two dropDowns. If I get into this page through Select Class -> Select Category pages I set

CascadingDropDown1.Enabled =false (and so on for all of them)
and use query string to populate DDLs and set selected value. Or I can directly get into this page and use CascadingDropDown since I don't have query string.

But it doesn't work this way. When I get into this page through Select Class -> Select Category pages everything is fine, but after first postback ddl's datasources are empty.

If I completely remove CascadingDropDown definition from code - it works OK.

Any idea why this happens? Not sure, probably I'm missing something or it's CascadingDropDown bug.

Thanks.

Vladimir.

Hi Vladimir,

Can you elaborate what do you mean by "Select Class -> Select Category pages" ?

I don't quite understand your problem.


Thanks very much for the replay.

I mean that I have on the page two DropDownLists. First I select Class then by this Class i can select Category. After I select Category I'm able to populate GridView.

On this page I can get either through direct link (in this case I don't have data for Class and Category and wanted to use CascadingDropDown) or I can go first on the page SelectClass. Then on the page SelectCategory which will move to the page where I'll have Class and Category already selected and available in the query string in the url address.

This is basically what I wanted.

CascadingDropDown placed inside an asp:EditItemTemplate.

I tried the cascading dropdownlist when the user clicks on edit on a formview, but I realized from the following error that this will not work:

System.InvalidOperationException: The UpdatePanel 'EditUpdatePanel' was not present when the page's InitComplete event was raised. This is usually caused when an UpdatePanel is placed inside a template.

I also found a previous threadhttp://forums.asp.net/thread/1255759.aspxwhere the respondent confirmed that the updatePanel must be outside of the GridView

Does that mean that theAtlasControlToolkit:cascadingdropdown control cannot be used within any databound templated controls (such as GridView, FormView, Details, etc.)?

I don't believe so. UpdatePanel has "special needs" on the page which is why it probably has this issue. I haven't tried this but I think CascadingDropdownshould work OK - I can't think of why it wouldn't. Can you give it a try and report back?


I think the problem is that theatlasToolkit:CascadingDropDown requires anatlas:UpdatePanel around the dropdownlists otherwise changing the selection in one dropdownlist would not affect the next. But sinceatlas:UpdatePanel cannot be placed within the EditItemTemplate therefore it seems that there is no way to put theatlasToolkit:CascadingDropDown within the EditItemTemplate.

Here I tried 3 scenarios in addition to the one I described in my previous post:

1- The cascadingdropdown lists work if placed within atlas:UpdatePanel outside of an EditItemTemplate:http://www.webswapp.com/codesamples/aspnet20/atlas/cascadingdropdown.aspx

2- The cascadingdropdown lists not working if placed within the EditItemTemplate and the atlas:UpdatePanel outside the FormView. http://www.webswapp.com/codesamples/aspnet20/atlas/cascadingdropdown2.aspx

(On my local PC, a JavaScript popup dialog box comes with the following error: "System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using in configuration or in a page." But when run remotely you do not get that error. The lists just do not display anything)

3- The cascadingdropdown lists not working if placed within the EditItemTemplate and no atlas:UpdatePanel on the page

The source code for all scenario are listed on the demo pages.


CascadingDropDown does not need an UpdatePanel to work - the client-side changes are done in script and the web service requests are async thanks to Atlas. So #3 above is the scerario you probably want. I suspect it's not working for you because your ParentControlID properties are pointing at "CascadingDropDownX", but your DropDown controls are named "ddlYYY". Please try fixing that and let us know how it goes!

Hi David,

Thanks for your help. Your suspicion was right. I had the wrong values for the ParentControlID. Now that I corrected them and got it working within the FormView's EditItemTemplate and the data is being updated upon postback successfuly as shown here: http://www.webswapp.com/codesamples/aspnet20/atlas/toolkit_cascadingdropdown.aspx

I am wondering about the possibility of doing 2 more features to make the function of this control equivalent to the server-side controls:

1- How to set the default values upon loading the EditItemTemplate? (Since I could not use the Bind or Eval statements)

2- In order to prevent flashing of the screen when I submit the FormView, I tried using the Atlas:UpdatePanel around the FormView but I got this error message:

Assertion Failed: Unrecognized tag AtlasControlExtender:ValidationScript


That is so cool!

From above...

1) This is a feature we've added to the refresh, which should be available within the next day or so. When it is, you can just add a "SelectedValue='blah'" to the properties and it'll select that value

2) I'm not sure why you're getting that. In any case, in your extender set "SuppressValidationScript='false'" and it'll preven that guy from even loading.


<atlasToolkit:CascadingDropDownID="CascadingDropDown1"runat="server" SuppressValidationScript="false">

I tried # 2 above but I still get the error. The code is exactly as listed in the link I provided before plus the updatePanel surrounding the FormView

<atlas:UpdatePanelID="UpdatePanel1"runat="server">

<ContentTemplate>

<asp:FormViewID="FormView1"runat="server" .... >

</asp:FormView>

</ContentTemplate>

</atlas:UpdatePanel>


SuppressValidationScript="true"

Ok. The first error (above) does not show up but the next errors (which used to appear after I clicked on cancel) is still repeated for each dropdown list: "Assertion Failed: Unrecognized tag atlasControlToolkit:cascadingDropDownBehavior"


That's often related to the relative position of the controls, the extender, and the UpdatePanel. Some wiggling around of the different items can sometimes solve the problem. If it doesn't - and if the new Toolkit release doesn't help - please let us know.

CascadingDropDown options is null or not an object

I have a couple of dropdown CascadingDropDown and the user is required to select an option from the first and then the second, and then click add. However, if they press add to fast, I get the error "'options' is null or not an object"

It's as if the the second dropdown is not full before the event is posted?!?!? Anyone know how I can prevent this?

Hi Poidda,

Based on my experience, to resolve this kind of issue we should make sure whether the problem is occurred on the client side or on the server side. Based on your description, I think your problem is likely occurred on the server side.

If it is a client issue, we suggest that you should keep the Button to be disabled until the last essential CascadingDropDown is selected. For example:

function pageLoad(){
$find("myCDEState").add_selectionChanged(onCCDSelected)
}
function onCCDSelected(){
//your other javascript code here.

$get("<%=Button.ClientID%>").disabled = false;
}

Otherwise , you should do some checking work on the server side. If it's null, return to the orignal page.

Best regards,

Jonathan

CascadingDropDown in User Controls

Hi all,

I ran into a problem the other day using CascadingDropDown and I thought I'd share it. It is this:

When using CascadingDropDown within a user control (or a custom control for that matter) you have two options for filling your dropdown list controls:

1. Use a web service method. This apparently (and I could be wrong here) makes it impossible for you to tune your results according to some information stored in the session. So it's fine for "static" data, but not fine for "dynamic" data which may depend on say, the current user.

2. Use a page method. That poses another problem; you don't know on what page your control will run, you can't decouple by using interfaces 'cause the methods the page has to implement need to be static (Shared in VB), so the best I could come up with is define a dummy interface which "reminds" the developer to implement those methods - and of course you need to implement them on every single page you use your user/custom control.

Now both these alternatives are not very appealing. Wouldn't it be better if CascadingDropDown could look in its container for the static methods instead of the Page?

Cheers

In this case,

u can just use normal dropdownlist control make it like cascadingDropDown, then put everything in the updatePanel


I am currently working on a composite control that creates multiple (1-xxx) controls inside of it dynamically (based on XML) one of them being a Cascading Drop Down control.

Once I get it working i'll post here to let you know how I did it.


Hi,

I just posted inanother thread about this issue. I agree it's a problem and think we should try to get it fixed in the Toolkit.

Thanks,
Ted

CascadingDropDown In a user control

Hi,

I'm trying to use the cascading dropdown control inside the edit template of a form view control which is wraped inside a user control. The cascading dropdown obtains its data from a database. Their is no problem geting the data. The issue is when I go to set the selected value of the cascading dropdown to a value in the FormView_databound event handler, the selected value is does not get set, it shows "Please Select" which is the value I set in the begining.

Please help

Please try your scenario with the recently available61106 release of the Toolkit (and ASP.NET AJAX Beta 2). If the problem persists, then please reply with acomplete, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!