How To Use Ajax In .net Page For Multiple Dropdown Control
Nov 29, 2010I want to use ajax in my asp.net page for multiple drop down controlCorrently I am using following code
[Code]....
I want to use ajax in my asp.net page for multiple drop down controlCorrently I am using following code
[Code]....
I have a requirement to allow users select multiple "Agencies" and populate the "Types" based on that selection. Cascading Drop down would have been a great fit if there is no mutliple selection involved. I am wondering if I could use a popup dropdown with chekcboxes. However, these checkboxes need to be populated dynamically by a web service. I am not very familiar with AJAX toolkit and what control would work best in this case.
View 1 RepliesI am using the cascading dropdownlist controls from the Ajax toolkit. I have everything working perfectly and all of my select changes work. I have 3 related select boxes that all work great for single item select. What I need is for my last dropdownlist to allow for the selection of multiple items. I have tried adding the 'multiple' attribute to the final dropdown list and it allows the selection of multiple items but I cannot get the items when I post back, just a single item.
View 7 Repliesi get the problem in updating the treeview nodes from databse.i have created a dropdown list and on selectionindex change event i written the code for selection of nodes in the treeview.on first time selecting the option in dropdown list i get the selected nodes which works fine..but when i change the option in the dropdown control the treeview nodes cant updated on page but it seems selected as per database in the code behind when i debbug it
View 7 RepliesI am using slider extender in an user control. I am adding that user control 2 times in a page. At that it gives me an error saying "Two components with the same id 'Slider1' can't be added to the application."
I am using Latest Version of AjaxToolkit and VS 2008 with .NET FWK 3.5.
I used UpdateProgress below is code
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="upT">
<ProgressTemplate>
<div class="modal">
<div class="center">
<img alt="" src="loader.gif" />
</div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
this is for just 1 updatepanel I have 6 updatepanel in my page how I can use UpdateProgress for all my update panel?
DropdownList 1 : It is the parent dropdown for dropdownlist 2. Dropdownlist 2 is filtered as soon as any value is selected from dropdownlist 1.
DropownList 2: It contains numeric data which is filtered on the basis of dropdownlist 1 selection.
DropdownList 3: It contains the units for the numeric data displayed in dropdownlist 2. If the user selects some unit in dropdownlist 3, the data in dropdownlist 2 should be filtered accordingly.
let me know whether it is possible to have 2 parents controlling the data in a single cascading dropdown?
i have 4 dropdownlist..state,district,place,product..where we have to select the product depend on state ,district ,place and product and there is search button for search particular product where iam using gridview to dipslay particular product deatails. i do not want to do auto past back eventfor page when i select dropdownlist...i tried using ajax but still i cant get through..i tried this code. how to use ajax for 4 dropdownlist & 1 button so that i can dispaly product deatails.
View 3 RepliesI am using AJAX ComboBox control (or I can use simple ASP.NET DropDown Control it does not matter) in my form. What I do is, I bind combo box control to my database and retrieve client names:
[Code]....
But here is the problem. I want First and Last names to go into separate TextBox controls (txtFirstName and txtLastName). Now it inserts Last Name and Firts Name in txtLastName control. At the same time I would really like to keep LastName + FirstName together in Combo Box.
I want to write a program to click a button to save a record. A confirmation window will show up before the record actually save to database. Once confirmed, it will show a modal popup.Here is the code:
[Code]....
The problem is, the Modal Popup shows up before the confirmation windows. Is there any way to control the execution sequence of AJAX controls?
I am new to Ajax Control Toolkit, with the help of online tutorials I had created a cascading dropdown list in asp.net and tested it on my local machine. For this dropdown list data source would be an xml file (which is saved on my local machine c drive). I haven't encountered any issues until I deploy the precompiled web site on to IIS 7. When I open the web site from IIS I would see the two dropdown boxes on the web page with an error "Method error 500". I believe this error occured due to incorrect xml file
path provided on IIS. I had copied xml and xsd files into IIS server C drive but it did not help out and then I created a network map and placed the xml and xsd files in that shared folder tried to access that path from web service, it's working on local machine but not on IIS. It would be great, if any one could explain me the solution.
Following is the .aspx and .asmx code:
.aspx code:
<form id="form1" runat="server"> <div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ToolkitScriptManager> <br /> <table> <tr> <td> <asp:DropDownList ID="DropDownList1" runat="server"
Height="20px" Width="257px"> </asp:DropDownList> <asp:CascadingDropDown ID="CascadingDropDown1" runat="server" Category="Category" TargetControlID="DropDownList1" PromptText="[select category]" ServicePath="~/WebService.asmx" ServiceMethod="GetCategory"> </asp:CascadingDropDown>
<br /> </td> </tr> <tr> <td> <asp:DropDownList ID="DropDownList2" runat="server" Height="20px" Width="257px"> </asp:DropDownList> <asp:CascadingDropDown ID="CascadingDropDown2" runat="server" Category="Type" TargetControlID="DropDownList2" PromptText="Select
Type]" LoadingText="Loading Type.." ParentControlID="DropDownList1" ServicePath="~/WebService.asmx" ServiceMethod="GetType"> </asp:CascadingDropDown> <br /> </td> </tr> </table> </div> </form>
.asmx code(.cs code):
[WebMethod]
public AjaxControlToolkit.CascadingDropDownNameValue[] GetCategory(string knownCategoryValues, string category)
{
XmlDocument _doc = new XmlDocument();
_doc.Load(HttpContext.Current.Server.MapPath("~/C:/ItSupportCategory.xml"));
XmlNodeList list = _doc.SelectNodes("/CategoryList/Category");
List<CascadingDropDownNameValue> categorylist = new List<CascadingDropDownNameValue>();
foreach (XmlNode node in list)
{
string catid = node.Attributes["value"].Value.ToString();
string catname = node.Attributes["name"].Value.ToString();
categorylist.Add( new CascadingDropDownNameValue(catname,catid));
}
return categorylist.ToArray();
}
[WebMethod]
public AjaxControlToolkit.CascadingDropDownNameValue[] GetType(string knownCategoryValues, string category)
{
int catID;
StringDictionary selectedvalue = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
catID = Convert.ToInt32(selectedvalue["category"]);
List<AjaxControlToolkit.CascadingDropDownNameValue> cascadingValues = new List<AjaxControlToolkit.CascadingDropDownNameValue>();
XmlDocument _doc = new XmlDocument();
_doc.Load(HttpContext.Current.Server.MapPath("~/C:/ItSupportCategory.xml"));
XmlElement root = (XmlElement)_doc.SelectSingleNode("/CategoryList/Category[@value='" + catID + "']");
for (int i = 0; i < root.ChildNodes.Count; i++)
{
string typeid = root.ChildNodes[i].Attributes["value"].Value.ToString();
string typename = root.ChildNodes[i].Attributes["name"].Value.ToString();
cascadingValues.Add(new CascadingDropDownNameValue(typename, typeid));
}
return cascadingValues.ToArray();
}
Xml File:
<?xml version="1.0"?>
<CategoryList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test.xsd">
<Category value ="1" name="SYSTEM WIDE">
<Type value ="1" name="Email"/>
<Type value="2" name="SAP Locked"/>
<Type value="3" name="Job Archive Full" />
</Category>
<Category value="2" name="SAP">
<Type value="3" name="Pricing Incorrect"/>
<Type value="5" name="New Item #"/>
<Type value="6" name="Reports"/>
<Type value="7" name="New User Setup"/>
</Category>
<Category value="3" name="OTHER">
<Type value="8" name="Production"/>
<Type value="9" name="Office"/>
<Type value="10" name="Toner for Printer"/>
<Type value="11" name="Security Camre Lookup"/>
</Category>
</CategoryList>
I have an update panel in a user control and I am adding multiple instances of it for example 5.
When that update panel refreshes the page load occurs 5 times.
How can I prevent it only for once?
I have a user control, that has an update panel and update progress control in it.
I use this user control in more than 1 location on the same page.... problem is, when ucA posts back, I see the update progress control for both ucA and ucB. I assume this is because it is a user control and the update panel and progress are named the same?
Either way - how do I make it so that the update progress only displays for the proper user control?
on page AutoCompleteExtender is implemented and just below it, one dropdown is there.
When AutoCompleteExtender displays the list it is getting hide by the below dropdown.
All the controls on page are dynamic.
So, i cannot hide the other dropdowns to get it work.
how to work with multiple series! for example: with 2 series and display the name of each series in the graph! like this example: URL...
View 1 RepliesI tried to use a DropDown-Control (WebDropdown from Infragistics) for the following function: Let the user enter any text or if he wishes choosing by a context menu two different "Already exist entries" in the DropDown-List from where he can choose a value. The behaviour should be this for the DropDown: Right-clicking on the DropDown-Control, filling the DropDownList in the server depending on the choosen context menu item, opening the DropDownList in the client.
The way I tried to solve:
Open (by javascript) a context menu by right clicking on the control
[Code]....
What's the problem? The problem is, that the above javascript function does find the WebDropDown1 control only if it is called client side (e.g. with a OnClientClick button event), calling it from server side (as in the ContextMenu_ItemClick subroutine) it does not find the WebDropDown1 control. The error is shown (translated into english): run time error: object expected.
Maybe a completly different solution is necessary as I transfer a windows forms program into a web form ajax style program. I could use a textbox with dropdownextender for example. But the problem seems to be always the same: uncoupling the dropdown function, which is a client side one, by first filling the dropdownlist on server side, and then invoking the dropdown event makes the problem.
I am getting [MethodError 500] when I use cascading drop down. below is my code
<tr>
<td >
Select a Hoster:
</td>
<td>
<asp:DropDownList ID="ddlFeaturedHoster" runat="server" ></asp:DropDownList>
</td>
</tr>
<ajaxToolkit:CascadingDropDown ID="cddHoster" runat="server" TargetControlID="ddlFeaturedHoster"
PromptText="Select a Hoster" LoadingText="Loading ..." Category="ActiveHoster"
ServiceMethod="GetDropDownContents" ServicePath="~/Hosting/HostingService.asmx"/>
Service Code:
[WebMethod]
[ScriptMethod]
public CascadingDropDownNameValue[] GetActiveHosters()
{
List<CascadingDropDownNameValue> returnList = new List<CascadingDropDownNameValue>();
HostersManager hosterManager = new HostersManager();
List<Hosters_HostingProviderDetail> hosters = hosterManager.GetAllHosters();
returnList.Add(new CascadingDropDownNameValue("--Please Select One--","0",true));
foreach (Hosters_HostingProviderDetail item in hosters)
{
returnList.Add(new CascadingDropDownNameValue() { name=item.HostingProviderName, value= item.HosterID.ToString()});
}
return returnList.ToArray() ;
}
[WebMethod]
[ScriptMethod]
public CascadingDropDownNameValue[] GetDropDownContents(string knownCategoryValues, string category)
{
knownCategoryValues = FormatCategoryWord(knownCategoryValues);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
HostersManager hosterManager = new HostersManager();
switch (category)
{
case "ActiveHoster":
values.AddRange(GetActiveHosters());
break;
case "ActiveOffer":
values.AddRange(GetActiveOffers(1));
break;
}
return values.ToArray<CascadingDropDownNameValue>();
}
/// <summary>
/// Formats the category word
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
private string FormatCategoryWord(string value)
{
if (string.IsNullOrEmpty(value)) return value;
if (value.LastIndexOf(":") > 0) value = value.Substring(value.LastIndexOf(":") + 1);
if (value.LastIndexOf(";") > 0) value = value.Substring(0, value.LastIndexOf(";"));
return value;
}
}
I've just downloaded the latest Ajax libraries. I have a web site with dozens of ComboBoxes that worked fine until intalling the new libraries. Now the combobox dropdown lists, show behind the other ComboBoxes on the page.There was also an issue where the dropdown lists didn't display in the proper position, the div they are contained in is set to Position:Relative, I had to add position:absolute ! important along with coordinates of coarse to the css .WindowsStyle ul
View 1 Repliesif a asp.net web site project is created using code behind as C# language then the Page and its controls events are not shown in the DropDown at top of the editable area in Visual Studio.But contrary to this if code behind is VB.NET then in the DropDown all Page events and its controls events are shown.
Is the same possible with code behind as C# language ?
I have a function on page load which will work based on dropdown selected value. and I am using this dropdown in a user control. So getting problem because the dropdown value is not loaded yet before Page Load. How Can I do that using those control still.
Here is my code below.
public partial class GradeEntry : System.Web.UI.Page
{
StudentManager studentManager = null;
CourseManager courseManagerObj = null;
GradeManager gradeManager = null;
[Code]....
I have a drop down list embedded in a menu panel in my master page. This ddl fetches it's list items from my SQL Server. They are:
1. Select a type --appended during page load
2. Green type -- fetched from SQL server via a datasource
3. Red type -- fetched from SQL server via a datasource
4. User Manual -- appended during page load
For the sake of simplicity my website has 4 pages. When the 'Select a type' list item is selected - the user should be taken to a general 'Introduction' page. When the 'Green type' - the user should be taken to a 'Green' page - and etc.
I Have the gridview control with 2 dropdown list and 2 text boxes,When the textbox chnaged event happen 1 row will create and the dropdown back to initial values( its not retaining the selected values),I am binding the control after text changed method,Is there any properties needs to be set or any other way we can retain the values in postbacks?
View 4 RepliesI am using cascading dropdown, model popup and update panel in my page.
my all drop down are in update panel. now i am retrieving values from the database through data reader and assign value of respective data to the respective control. but control (drop down list) shows "--select--" and not the retrieve value i.e. "Hospital"
Following is the code:
<table>
My scenario is i have 4 tabs, under every tab there are five cascadded combo. So for page load itself it calling webservice at last and populate all parent cascaded dropdowns in all the four tabs.
now I have made changes but still now its not working. By defeault [ScriptMethod(UseHttpGet = false)], so i made it [ScriptMethod(UseHttpGet = true)]. now on tab change i added that function and it is calling the web methods when changing the tab. But after the loading its again call the webservice and this time as the get is true so its not getting any value. And in the dropdown its showing "error 12030".
I have a master page with an accordion in it inside the accordion panel1 are 3 dropdownlists (ajax cascading) and a button when the default page is loaded i want to select the dropdown values(this works) and then click the button to redirect to another page called test.sapx (this works). The thing i also want to do is pass the dropdownlist values to the new page as the dropdownlists reset. I was trying to do this through the click event on the button and set them in a session variable. The click event isn't firing at all. The page redirects and then if i click the button again it fires the event?
View 4 Replies