473,847 Members | 1,772 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
27 7929
user1980
112 New Member
Expand|Select|Wrap|Line Numbers
  1. function window_open()
  2.       {
  3.        window.open("Codes.aspx","","menubar=no,status=no,scrollbars=yes,resizable=yes,toolbar=no,top=180,left=250,width=750,height=600");
  4.       }
the ap.net control that calls it,
Expand|Select|Wrap|Line Numbers
  1. <asp:Button runat="server" ID="btnlookup" Text="Code" OnClientClick="window_open()" CausesValidation="false" Width="90px" />
Dec 7 '09 #11
Frinavale
9,735 Recognized Expert Moderator Expert
I don't see anything wrong with this JavaScript.
I'm going to ask that a JavaScript expert take a look at this.

Does this problem prevent your code from being executed?
If so, could you remove it while we are fixing your current problem with dynamically populating the DropDownList?

-Frinny
Dec 7 '09 #12
Dormilich
8,658 Recognized Expert Moderator Expert
I'm going to ask that a JavaScript expert take a look at this.
I can’t find anything wrong, works as expected when inserted in plain text HTML.
Dec 7 '09 #13
user1980
112 New Member
my page executes normally. but I just wanted to get rid of the error and also wanted to postback the page when I check the checkbox.
Dec 7 '09 #14
Frinavale
9,735 Recognized Expert Moderator Expert
Well enable autopostback for the checkbox.
Put a break point on the method that handles the event and run the application.
Do you hit the break point?

-Frinny
Dec 7 '09 #15
user1980
112 New Member
ah..it does not hit the breakpoint. and the script error is displayed only when I try to check the checkbox, not when the page loads.
Dec 7 '09 #16
Frinavale
9,735 Recognized Expert Moderator Expert
Okay, it sounds like the JavaScript that preforms the AutoPostback is not working.

I don't know why this would be the case. The only thing that I can think of is that your JavaScript is somehow invalid (maybe you didn't close the <script> tag?) But your JavaScript looks fine.

Try removing your JavaScript from the page.
Do you get the same error?

What web browser are you using? What version is it?

Are you using Ajax?
If so are you using any Ajax enabled controls?
These may be causing a problem...


-Frinny
Dec 7 '09 #17
user1980
112 New Member
Hi Frinny

Thank you for your quick responses.

I did try to remove the javascript from the page. it still gives me the error. I am currently using IE7 and I do not have any ajax controls.
I did try to create a new checkbox list and even that gives me the same error.

I created a new page and could figure out the how to create a dropdown when a checkbox is selected. It works fine. But my original page still has the error for the autopostback.

Your help is greatly appreciated.
Thank you...
Dec 7 '09 #18
Frinavale
9,735 Recognized Expert Moderator Expert
It's too bad that you were having such a hard time with your original page.
At least the error isn't happening on your new aspx page.

So, in the method that handles the AutoPostback for the CheckBoxList (list??) you need to create list items for your DropDownList based on what was checked/selected.

(I'm not sure what language you're using.)

There are two ways to do this. You can create generate ListItem objects and add them to your DropDownList's "Items" property. Or you can bind your DropDownList to a data source.

-Frinny
Dec 7 '09 #19
user1980
112 New Member
yeah. I did use the items property to make my dropdowns work and it works fine, but still could not figure out what is wrong with original page.

Anyway thanks a lot for your help and support.
Dec 7 '09 #20

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

Similar topics

4
5492
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
2133
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
6189
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
4401
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
2203
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
5824
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
0
1090
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
1947
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
9730
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
10341
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
9485
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
7056
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5719
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
5911
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4529
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4119
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3164
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.