473,805 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically populating a DropDownList, AutoPostback and JavaScript error

112 New Member
hello,

i am trying to create a request form using asp.net where when a user selects a checkbox, a dropdown should appear dynamically. I have seen few java-scripts in web, but I was wondering if I can achieve this without java-script.

I tried to make the control invisible(<asp: DropDownList ID="DropDownLis t1" runat="server" AppendDataBound Items="True" Visible="False">) and in the onselectedindex changed event, tried to make the invisible property to true. But it did not help me.
Also, I was trying to use postback for the page when a checkbox is selected(asp:Ch eckBoxList ID="chckbx" runat="server" AutoPostBack="t rue" onselectedindex changed="chckbx _SelectedIndexC hanged") and it throws me an error in IE saying the object does not support this property.


Can somebody please help me with this. Thanks in advance.
Dec 7 '09 #1
27 7926
Frinavale
9,735 Recognized Expert Moderator Expert
Before you continue please take a look at this article on:
How to use dynamic controls in ASP.NET.

-Frinny
Dec 7 '09 #2
user1980
112 New Member
thank you for the reply.

I am able to understand the example in the link but could not really put it into working for my scenario.
Dec 7 '09 #3
Frinavale
9,735 Recognized Expert Moderator Expert
Ok, in your scenario you need to do this when the user checks a checkbox.
I'm assuming that you need to populate the drop down list with items depending on what the user has checked.

This is not dynamically creating a control.

What you need to do is dynamically populate the drop down list.

What do you have currently that we can use as a starting point?

-Frinny
(PS please post code in code tags)
Dec 7 '09 #4
user1980
112 New Member
Yes, I have to populate the dropdown based on the selection of checkbox.

Here is my information. I have four sources of information as checkboxes, newspapers,web, employee and others. Now when a user checks newspapers, the dropdown must populate, tribune,WSjourn al,PJ star.

And one more thing is if I put the autopostback ppty for checkbox to true, it throws me an error. This should be something very basic, am I missing something?
Thanks for all your help.
Dec 7 '09 #5
Frinavale
9,735 Recognized Expert Moderator Expert
Lets fix the error because you need to set the checkBoxList's autopostback=tr ue.
Please post the error details.

-Frinny
Dec 7 '09 #6
user1980
112 New Member
the error appears only in IE, as a script error. I mean the page loads normally but on the left hand bottom corner, it says there is an error on the page. When i click on it, it tells me the the object does not support this property or method.
When I try to debug the page without the autopostback property, it does not display any error.
Dec 7 '09 #7
Frinavale
9,735 Recognized Expert Moderator Expert
Do you have any additional JavaScript on the page?

-Frinny
Dec 7 '09 #8
user1980
112 New Member
yes, a one line javascript to open a pop-up window.
Dec 7 '09 #9
Frinavale
9,735 Recognized Expert Moderator Expert
Post that code please.

-Frinny
Dec 7 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
5485
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new dropdownlist to the screen for selection. This continues until there are no children, and then it checks for a help article list based on that last selection and displays actual articles for display. Adding the controls and getting everything...
0
2129
by: theo | last post by:
Hello..I have a similar issue as yesterday but the situation has slightly changed so perhaps someone can shed some more light on the issue... Program flow - load file,extract xml text tags from file,then depending on the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the placeholder,the user selects the required tags from the dropdownlists (if 5 Xml tags,then 5 dropdownlists...
0
367
by: Thomas Due | last post by:
Hello, I am in the process of making my asp.net form to validate as xhtml 1.0 strict. So far I am doing well, but now I have a problem. The problem concerns specifically DropDownList and ListBox, but other controls might result in the same problem. When AutoPostBack is enabled on these controls, two hidden input fields are created on the form (__EVENTTARGET and __EVENTARGUMENT), furthermore a "postback" javascript is embedded, this...
7
6187
by: Daniel | last post by:
Is there any other way can override this event, like javascript onchange added to the attribute of this dropdownlist? Thanks
5
4398
by: bryanp10 | last post by:
I have a page that is almost entirely dynamically created. Textboxes and checkbox are working fine, firing events, and persistent their state. DropDownList is giving me a major headache. All my controls are created in CreateChildControls() for my custom control. Here's a snippet of code: DropDownList dd = new DropDownList(); dd.ID = "DropDown1"; if( !Page.IsPostBack )
1
2201
by: Wim | last post by:
Hi Everyone, I'm trying to speed up a Asp.net 1.1 applications' performance. The application needs to run in an environment with little bandwith and therefore pagesizes and roundtrip times shoud be brought back to a minimum. The application suffered from relatively large screens. A typical aspx page was 500 Kbyte so page load times were in the order of 40 - 50 seconds. After unsufficient loading improvement using .net caching
11
5818
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
0
1087
by: eurorscg | last post by:
Hi, i have this dropdownlist that breaks xhtml w3c validation.because it generates a select tag with a javascript property. this only happens when autopostback is set to true. so the the validation error that i get is this: # Error Line 263 column 86: there is no attribute "language".
0
1945
by: asmx126453 | last post by:
Hey mensen I am having some big troubles here i tryd solving it myself with internet for 2 days but i kind fix it. Its about this i have a DotNet project that alrydi is online and working for almost everything. but it whas made in Visual Studio 7 and i converted it to 2005. in version 7 it works almost perfect but in 2005 i am having some errors. becase all the code i am using is very long i am trying to post the nesecery code only if...
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.