AJAX :: Cascading Dropdowns Reload On Event Trigger?
Oct 15, 2010
I have three cascading dropdowns and two of them need to trigger something outside of the dropdowns, so I have OnSelectedIndexChanged events on them. So as to not reload the whole page when these items are triggered, I have all of this in an Update Panel.
Everything works fine -- the only issue that the client doesn't like is that the cascading dropdowns reload on the asynchronous postback.
I've been working on my first version of an ASP.NET app, using cascading dropdowns. I've got 2 dropdowns on a page.
However, the third major control on the page is a details view. It works fantastic, with the cascading dropdowns, to display information from the second dropdown, and allow the user to edit that data. All well and good. But now, in testing, I suddenly realized that I've got no way of displaying the details view if I want to let the user enter new data, which would show some information in the second drop down.
This has totally spoiled my .net 4 vs2010 realease day happiness. Running Cascading dropdowns using 'webservice' asmx method. Everything worked on .3.5 and i solved the running 'code In page' method with this post. Method error 500 [URL] Thought I was sorted but seems the rules are totaly different for the 'webservice method'. For example where did ToolkitScriptManager come from Ive been using ScriptManager for years. Anyway below is the Webservice and Page code. Ive looked at and tried everything of the forum but all of it is pre .4. This is demo code, the real version has 3 dependant dropdowns and the lookups are used several times so it HAS to be a webservice. My current theroies are:
1. Permissions- dosent makes sense. 2. Something missing in web.config to enable webservices. 3. Something to do with placement of 'System.Web.Script.Services.ScriptService()>'
I have 3 dropdowns in my VB.Net 3.5 web app. After a user selects a value from the first (let's call it Countries) the second (called States) should populate correspondingly. Dropdown three (cities) should also cascade down after a State is selected. The Countries and States dropdowns have SQL DataSources. The Cities dropdown has to call 2 procs (based on the selected State value) so it does not have a SQLDataSource. My question is, the code below works for Countries and States, however, I cannot ge the Cities to populate...
<asp:DropDownList ID="drpCountries" runat="server" DataTextField="CountryName" DataValueField="CountryId" DataSourceID="sdsCountries" AutoPostBack="true"> </asp:DropDownList> <asp:SqlDataSource ID="sdsCountries" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" SelectCommand="SELECT * FROM [Countries] ORDER BY [CountryName] ASC"></asp:SqlDataSource> <asp:UpdatePanel ID="updStates" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="drpStates" runat="server" DataTextField="StateName" DataValueField="StateId" AutoPostBack="true" DataSourceID="sdsStates"> </asp:DropDownList> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="drpCountries" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> <asp:SqlDataSource ID="sdsStates" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" SelectCommand="SELECT * FROM [states] WHERE StateId = @StateID ORDER BY [StateName] ASC"> <SelectParameters> <asp:ControlParameter ControlID="drpCountries" Name="StateID" PropertyName="SelectedValue" DefaultValue="" /> </SelectParameters> </asp:SqlDataSource>
THIS DOES NOT WORK:
<asp:UpdatePanel ID="updCities" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="drpCities" runat="server" DataTextField="CityName" DataValueField="CityId" AutoPostBack="true"> </asp:DropDownList> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="drpStates" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> Protected Sub drpStates_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles drpStates.DataBinding ' Call some procs and get a DataSet drpCities.DataSource = ds drpCities.DataBind() End Sub
I am using cascading dropdown list where the no of dropdowns is created dynamically on the page. The cascading drop downs are contained in a User Control. I need to call a method from the Parent page which will be executed when the values in one of the dropdowns change. The server side event is not firing as I have set AutoPostback property for the dropdownlists to be false. How can i make the Page event fired from the Selected index changed of the dropdowns keeping the autopostback property to be set as false.
I have three cascading dropdowns on my web page and they work fine. The issue I am facing is that there are other controls on the page which cause a postback and with each postback the cascading drop downs are being re-populated (service methods are called) which is becoming a performnace issue.
I add cascading drop down in a place holder during page load. When i submit the entire form, i found out that my drop down list is reload and my selected value is not selected.
i can populate cascading dropdownlist by using webservice now. but may i know how do i trigger function while selectedindex changed? (without using auto postback...)
I have searched around but unable to find a solution that will work. I have a link button that is created dynamically during the page load. It is given an ID (obviously). There is a script manager on the page. I have the controls added to a panel in the updatepanel (updatePanel1). There is a dynamic label that is also created with each link button. I can get a response from the linkbutton click event during a postback on the second time clicking the linkbutton, but I am getting a complete postback instead of the asyncpostback for that control. During the creation of the dynamic linkbuttons, I am also creating a dynamic trigger for each button and adding it to the updatePanel1. The Click event is not firing the method without doing a complete page postback.
In my application I am using ajax updatepannel in which there is a tab container tool having 4 tabs, in the third third tab I used ajax accordian control which has 2 panel each pannel have one gridview control a Remove button. Here what I want to give delete facility to the user upon the selection of checkbox corresponding to the particular record. But when I click the button it doesnot triger the button click event of the remove button.
I created a MultiHandleSliderExtender on a web form. All works well with updating the two textboxes with the value. The problem is that when I switch to designer mode, I get the following error:
The code is as follows:
[Code]....
[Code]....
[Code]....
The control works and the 2 text boxes get updated, but I tried putting in an update panel with a trigger on mh_1_BoundControl but it never fired. I removed it thinking that was the cause of the error, but no luck.
Now when I add another sliderextender below it for a different value, the code throws an error:
Microsoft JScript runtime error: Sys.InvalidOperationException: Type AjaxControlToolkit.SliderOrientation has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.
I found this example on this site and tried implementing it but to no avail.
I have a cascading dropdownlist. The first drop down is for Departments and is databound on PageLoad from the database. The user then selects a department and the second dropdown is populated with the appropriate sub departments via JQuery/JSON which calls an httphandler. The problem is as follows: I select a department and the subdepartments are filled.
I finish what I'm doing on that screen and everything is fine. But then if I go to a different screen and add an additional subdepartment then come back to original screen, the new sub department won't appear in the cascading dropdown. I have to close the browser and restart the session in order for any new sub departments to appear even though they are in the database. I put a breakpoint in the httphandler and noticed that it is only called once per session per each department in the first dropdown. I don't know why this is happening. I want it to call the httphander EVERY time the index of the department dropdown is changed.
I am using panel to hide and display certain controls on a page, On one of my panel i have three drop down, all i want is to make sure that user has selected something from the dropdowns otherwise they cant proceed, i am using the requiredfield validator but its just not working
i am currently developing an asp.net project. there is a previous, next, and cancel button that the user can utilize, but the problem is that everything is broken into controls so that if they hit the browser's back button it will reset everything and take them to the very beginning. i would like to capture the onbeforeunload event and trigger the previous button click event (i.e. treating navigation like clicking the previous button).
I have 45 dropdown lists in my asp page. There are some methods that I can apply to all of these dropdowns. Is it possible to convert them into an array of dropdowns for ease of use?
I am building a system for a school project. I currently have several Update Panels on the page that have many different controls on them. I also have a single Label control that i use to display messages to the user. I would like to have this label within an update panel also but there are literally hundreds of triggers that would require it to be updated and i dont want to type an absurd number of triggers for this one control.Is there a way for me to have this one panel update regardless of what happens?
Not sure I understand why Button1_Click() is executing on a page reload. I put in a break point in the function and it does hit it as well as update the database.