AJAX :: CascadingDropDown List - 'undefined' Value When Used With Regular Dropdown?
Jan 5, 2010
I have 2 dropdowns, 1 regular and the other child dropdown has a cascadingdropdown component attached to it.In the past I have used 2 cascadingdropdowns but I'm not sure if the 1st is necessary as it is not being populated by any other dropdown. Can someone confirm this is the case?econdly, in the webservice used by the cascadingdropdown, the key value passed into the webservice function call has 'undefined:x' where x is the value selected. How can I ensure that the category is set correctly? Is this because the parent drop downisn't a cascadingdropdown? Is this a problem, or should I just parse for 'undefined'?
View 2 Replies
Similar Messages:
Jun 21, 2010
I am trying to create a cascading dropdown list using two dropdown lists in Visual Studio 2008 Professional connecting to a SQL Server 2008 Standard database on my local machine. I have added the two dropdown lists, as well as a CascadingDropDown extenders from the AJAX Control Toolkit that corresponds with the first dropdown list. The problem I am running into is that despite the fact that I have a CascadingDropDown extender for the first dropdown list so far, and the extender is configured properly, the first dropdown list is showing Unbound in Design view. I also don't see a TargetControlID entry in the properties window for the externder.
I hard coded the TargetControlID to the extender in the Source view and, although I am not receiving any dynamic errors from the TargetControlID entry (meaning, the TargetControlID is a valid parameter, and the dropdown list I entered for that parameter exists on the same page), the dropdown list doesn't populate properly and when in Design view, not only do I not see an entry for the CascadingDropDown extender, but the target dropdown list shows as being "Unbound."
A couple of things I want to point out first:
1) I am using Master pages on this site for the header, footer and navigation. The opening and closing <form> tags, as well as the <ScriptManager> entry are in the Master page, not the content pages. I did this with the assumption that at runtime, each page would have the proper <form> tags and <ScriptManager> entry to function properly.
2) I have been able to add a CascadingDropDown extender to a page in Design view (and it initially displays properly), but by the time I have added all of the properties settings to apply it to its corresponding dropdown list, the entry appears normal in Source view but no longer appears in Design view. When I run the page, the dropdown list does not populate. Obviously, I assume that this is related to the dropdown list showing in Design view as being Unbound, but I don't know how to get the dropdown list to recognize that I have a CascadingDropDown extender that is supposed to apply to it.
Here is what the two elements look like in Source view:
<asp:DropDownList ID="ddlCompany" runat="server">
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="cddCompanies" runat="server" TargetControlID="ddlCompany" Category="Company" PromptText="Select a Company" LoadingText="Please Wait..." ServicePath="~/CompaniesService.asmx" ServiceMethod="GetCompanies">
</ajaxToolkit:CascadingDropDown>
To create these, I have been following Joe Stagner's example in his video on the topic (http://www.asp.net/ajax/videos/use-aspnet-ajax-cascading-drop-down-control-to-access-a-database) virtually word for word. I have set up two TableAdapters/DataSets, one for each dropdown list, and the datasets are able to accurately pull the appropriate data from the database, so I know those are working properly. I believe the problem is that the dropdown list isn't binding with the CascadingDropDown extender properly. It wouldn't bother me that I don't see a TargetControlID entry in the properies window for the CascadingDropDown extender, although I have a feeling that the absense of that property is related to the fact that the dropdown list is not binding to the extender. I searched online for causes to this problem, but I wasn't able to find any solutions.
View 3 Replies
Mar 15, 2010
i have a religion dropdown1 , on this selectedindexchange i have to populate castes into the listbox(not dropdownlist).
i am unable to use cascadingdropdown as it is tightly binded with dropdowns.
please guide me how do i update listbox items based on the dropdown selected value using ajax.
i tried with pagemethods getting the dictionary object using JS function and thought of binding it.
but i am unable to bind the list.
//html code
Religion
<asp:DropDownList ID="ddlReligion_RS" runat="server" TabIndex="6" onchange="GetCastes_RS(this.value);">
</asp:DropDownList>
<br />
Caste
<asp:ListBox SelectionMode="Multiple" ID="lstBxCst_RS" runat="server">
</asp:ListBox>
//js function
function GetCastes_RS(relgnID)
{
abc.BLL.Services.AjaxService.GetCastes(relgnID,
function (resp)
{
var ddlCaste= document.getElementById("<%=lstBxCaste_RS.ClientID%>");
ddlCaste.length=0;
var castesList = resp;
alert (resp);
if(castesList.keys.length >0)
{
for(var i=0 ;i< castesList.keys.length;i++)
{
op=castesList.keys[i];
ddlCaste.options[ddlCaste.length]=new Option(castesList.values[i],op);
}
}
},
function(val)
{
alert(val.get_message());
}
);
}
i could call the webmethod, but i am getting this error in javascript.
Type 'System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]' is not supported for serialization/deserialization of a dictionary, keys must be strings or objects.
when gone thru few links i have seen few examples supporting dictionary object , why not in my case?
View 1 Replies
Aug 5, 2010
I am using Cascade dropdown the basic code which i used write down below i am reading data from xml file for Country,State,City.before sometime it was work fine but now it give me an "undefined" data in state dropdown only.
Basically i make a user control on this page my design code are as follow
[Code]....
and on one aspx page i call this control and put a one webmethod for state dropdown
[Code]....
View 1 Replies
May 7, 2015
I have 3 table in database
1-state
Id state
1 USA
2 UK
2-City
Id name state
1 Canada USA
2 London UK
3-Region
Id regionname cityid
1 01 Canada
2 02 London
and I have 3 DropDownList that refer below thread [URL] ...
I use cascadingdropdown for these 3 dropdownlist below are codes:
AND
[WebMethod]
public CascadingDropDownNameValue[] GetCountries(string knownCategoryValues)
{
string query = "SELECT state FROM stateTest";
List countries = GetData(query);
return countries.ToArray();
}
[Code] ....
1-DDLstate
2-DDLcity
3-DDLregion
at first I should select Item from DDLsate then DDlcity and at the end I should select Item from DDLregion
above code work correctly for ddlstate and ddlcity but it doesn't work for ddlregion...
I mean when I select Item from ddlcity in ddlregion shows:[Metod error500]
View 1 Replies
Nov 10, 2010
How can i generate dropdown lists based on what has been selected in the checckbox list. Below is an example of what i need. if the user selects the options day, lotID and waferID, then 3 cascading dropdown lists should be displayed. And then a gridview displays data based on what has been chosen in the dropdown lists.
Day
LotID
SlotID
WaferID
VendorID
ToolID
LocationDetected
ProcessStep
Stage
Precipe
WaferStartMaterial
WaferStartVendor
WaferStartLot
WaferDiameterCOA
WaferMapTitle
BreakPoint
BreakpointSide
BreakpointMeasurement
View 3 Replies
Aug 20, 2010
I have a Cascading drop down list that is working fine to load the correct lists however I would like to have the last one initiate a query and display a datagrid on the same page containing the results of the query. Without Ajax involved this seems rather easy by using autopostback on the drop downs. If I could do it through Ajax that would be great but I can settle with having the page to reload to display the data. Right now I'm not sure how to do either. I enabled autopostback on the last drop down and wrote a method for it but I get an error at runtime saying:
Invalid postback or callback argument
View 4 Replies
Oct 10, 2010
I am stuck at this point "Displaying a dropdown list of Categories with a --None -- Option. I want the gridview control to display 2 dropdown list one in read-only mode and the other in edit mode. When a record is in read-only mode, the dropdownlist's enabled property will be set to false."When it's on a read-only mode, it doesn't display the selected Category. it shows but the "No Category". When i click on edit to edit or change category, it doesn't display the selected category.
The example is given below( I am reading the book Sams Teach yourself ASP.NET 2.0 by Scott Mitchell. page 628)
<asp:Label ID="UserIdValue" runat="server" Visible="False"></asp:Label>
<asp:SqlDataSource ID="picturesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Pictures] WHERE ([UserId] = @UserId) ORDER BY [UploadedOn] DESC"
DeleteCommand="DELETE FROM [Pictures] WHERE [PictureID] = @PictureID"
InsertCommand="INSERT INTO [Pictures] ([UserId], [CategoryID], [Title], [Description], [UploadedOn]) VALUES (@UserId, @CategoryID, @Title, @Description, @UploadedOn)"
UpdateCommand="UPDATE [Pictures] SET [UserId] = @UserId, [CategoryID] = @CategoryID, [Title] = @Title, [Description] = @Description, [UploadedOn] = @UploadedOn WHERE [PictureID] = @PictureID">
<DeleteParameters>
<asp:Parameter Name="PictureID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="UserId" />
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="UploadedOn" Type="DateTime" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text"/>
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="UserId"/>
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="UploadedOn" Type="DateTime" />
<asp:Parameter Name="PictureID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="categoriesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId)">
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="maxPictureIDDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT MAX(PictureID)
FROM Pictures
WHERE UserId = @UserId">
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:Label ID="cannotUploadImageMessage" runat="server"
Text="The photo could not be added to your album either because you did not specify a file to upload or the file specified was not a JPEG image with the file extension .JPG"></asp:Label>
<br />
<asp:DetailsView ID="dvPictureInsert" runat="server"
DataSourceID="PicturesDataSource" Height="50px" Width="125px"
AutoGenerateRows="False" CellPadding="4" DataKeyNames="PictureID"
DefaultMode="Insert" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<EditRowStyle BackColor="#2461BF" />
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
<Fields>
<asp:TemplateField HeaderText="Picture">
<InsertItemTemplate>
<asp:FileUpload ID="imageUpload" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="imageUpload" Display="Dynamic"
ErrorMessage="There was no file selected" ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category" SortExpression="CategoryID">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="pictureCategory" DataSourceID="categoriesDataSource"
runat="server" DataTextField="Name" DataValueField="CategoryID"
SelectedValue='<%# Bind("CategoryID") %>'
Visible='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True" Value="">-- Select Category --</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" Display="Dynamic"
ErrorMessage="you must provide a name for the title"
ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Title") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Description") %>'
View 2 Replies
Dec 22, 2010
We have a site running FW 2.0 on IIS 6. Actually two sites (on the same server), one works and one has that little Done with errors note in the lower left. The errors are 'Sys' is undefined & WebForm_SaveScrollPositionSubmit' is undefined. I have cleaned the bad site, copied the code from the good site, including web.config, and still see the problem. This was working for a number of months, then I guess we didsomething, and now the errors.
View 2 Replies
Apr 6, 2010
I am using ASP.Net 3.5. I have fiiled dropdown list in javascript using ajax service but unable to get its selected value in button click event on server side.
View 1 Replies
Jun 23, 2010
I'm working with CascadingDropDown Lists, like CAR > MODEL > ACESSORIES.
Everything have worked fine, but there are some CAR MODELS that don't have ACESSORIES, so I want to HIDE the DROPDOWN "ACESSORIES" if a MODEL that doesn't have ACESSORIES be selected. If the user select a MODEL that has ACESSORIES, so the DROPDOWN ACESSORIES appears.
I think that I might use something like "DIV STYLE:HIDDEN"...
View 5 Replies
Aug 29, 2010
I just implemented a simple Ajax drop down list. The problem I'm facing is that when I run the project I will not be able to select the values from drop down even though there are 4 values coming in.
Here is my code:
Default.aspx
[Code]....
Default.aspx.cs
[Code]....
View 10 Replies
Feb 2, 2010
I am new to using Ajax Control toolkit. I need to create a dynamic cascading dropdowns in which the no of dropdowns will be programatically decided. Also the last dropdown can be replaced with a listbox as well. how i can leverage the Ajax toolkit's cascading dropdown.
View 2 Replies
Sep 20, 2010
my page contain a dropdownlist which binding many list of data with no categories. While refresh in one update panel is very slow.
View 4 Replies
Apr 8, 2010
I am using List search extender for dropdowns in my application. When I type "abc" it is listing out all items which starts with abc..with items starting from the top of the dropdown. But inIE8.0 items are starting from the bottom of the dropdown which makes user again to scroll.
View 3 Replies
Mar 23, 2011
I have the dropdownlists in UL. the entire Ul is in update panel. When the 1st dropdownlist is changed the second one is populated like a cascading dropdown.When i change the first dropdown the list starts from 0 instead of A :( this happens only in idiotic.IE I have the css as below
[code]...
Am i doing anything wrong or is this a bug in IE?
View 1 Replies
Oct 9, 2010
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 Replies
Mar 31, 2010
I've 2 dropdownlists, both are binded to a cascadingdropdown. Whenever I select an option in the 1st dropdownlist (parent), the options in the 2nd dropdownlist (child) will repopulate based on the options I selected in the parent dropdownlist. I need a javascript function to reset the options of both dropdownlists in their initial state (the prompt text).
I've tried changing the selectedIndex of the parent dropdownlist. However, this only changes the selected option in the parent dropdownlist. It does not reset the child dropdownlist to its initial state (which is supposed to be disabled and without any options). Need the script to reset the chained dropdownlists?
View 3 Replies
Mar 25, 2010
is there a way to cancel the current selection for a cascadingdropdown list ? For example, user changes selection, I present user with option to cancel selection and if he chooses to cancel, then the old value should be reverted.
View 9 Replies
Jan 29, 2011
I am using ajax cascading dropdown list one of my program. my code given below.
<asp:DropDownList ID="drpSeason" runat="server"></asp:DropDownList>
<cc1:CascadingDropDown ID="drpSeason_CascadingDropDown" runat="server" Enabled="True"
TargetControlID="drpSeason" ServicePath="Cascade.asmx" ServiceMethod="GetDropDownCategories" Category="category" PromptText="[Season]"> </cc1:CascadingDropDown>
<asp:DropDownList ID="drpb_SalesNo" runat="server" Width="70px"></asp:DropDownList>
<cc1:CascadingDropDown ID="drpb_SalesNo_CascadingDropDown" runat="server" Enabled="True"
TargetControlID="drpb_SalesNo" ParentControlID="drpSeason" ServicePath="Cascade.asmx"
ServiceMethod="salesNo" Category="Sales" PromptText="[Sale]"> </cc1:CascadingDropDown>
And my webservice code given below:
[Code] ....
My Cascading dropdown list work properly. But when I am trying to save my data by below code:
[Code] ....
My Add button doesn't post back. If I delete my cascading dropdown then my code work properly.
View 5 Replies
Jun 29, 2010
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.
View 3 Replies
Oct 29, 2010
I am using the newest AJAX control toolkit. What I want to accomplish is I have a modal popup panel with cascading dropdown list and radio button inside. The issue is the postback. RadioButton and Cascading dropdown have postback so that will cause the modal panel disappear after the postback. I just want the panel disappear after I click the ok button on the panel and send the data into a field in a page. What I did was I placed the update panel inside the popup panel. If I did that, I would see the dropdown lists automatically refresh every time by accessing the webservice. If I placed the update panel outside, the dropdown would not be triggered. Even I set the trigger for the Update Panel, it will not see that way.
View 2 Replies
Nov 3, 2010
I have 2 drop down lists.I have a very simple dropdown list #1 that diplays a title and holds an id value which is a GUID.I know it is getting this value and sending this value as I tested sending it to a label.I have the dropdown list #1 to autopostback to dropdown list #2 that "Is supposed to get" another title and value based on the GUID value of the first dropdown list. for some reason it wont return anything. I have done 100's of these but never based off a guid value.I assume the value needs to be converted to guid before selecting it in the second dropdown list.How can I do this? or is there something I am missing?
View 9 Replies
Mar 8, 2011
I have set the Dropdownstyle to DropDown but its still not highlighting the item in the list
<ajaxToolkit:ComboBox ID="cmbstudentid" runat="server"
AppendDataBoundItems="True" AutoPostBack="True"
Font-Names="Tahoma" Font-Size="Small" [code]....
View 1 Replies
Jan 26, 2010
i manage to add recrod via jquery ajax call to webmethod but i want to update the dropdown list once the record is been added. i dont want to use update panel. what would be the best way of doing that.
View 2 Replies