Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 5th, 2007, 03:44 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prashant_telkar Send a message via MSN to prashant_telkar Send a message via Yahoo to prashant_telkar
Default problem in registration form

i m designing registration form.i hav created a drop down box which contains list of different cities.now if the user does not find any particular city then i hav given choice for OTHER option..now problem comes when he selects OTHER option i want a new textbox to visible and can enter his uniqne city which is not in dropdown box.


plz help with code and explanation

prashant
 
Old July 5th, 2007, 03:54 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

So where do you find the problem, use the onchange event of dropdown and write a javascript function, here check the dropdown's selected value or text for Others, and display the textbox. You can write something like below:

sel: id of dropdown
txt: id of textbox
var obj = document.getElementById("sel");
            if (obj.options[obj.selectedIndex].text == "Others")
            {
                document.getElementById("txt").style.visibility = "visible";
            }
            else
            {
                document.getElementById("txt").style.visibility = "hidden";
            }

Regards
Mike

Don't expect too much, too soon.
 
Old July 9th, 2007, 04:23 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prashant_telkar Send a message via MSN to prashant_telkar Send a message via Yahoo to prashant_telkar
Default

hi Mike thank u for the code......but i would not get onchange event of dropdown box, i m able to get in dropdown events like selectedindex change and ontextchange events....plz give more instructions......waiting for ur reply asap

prashant
 
Old July 9th, 2007, 07:20 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, the onchange event will work for both server side and client side controls, although you may not find it in Intellisense, just write it, and check the result.

Regards
Mike

Don't expect too much, too soon.
 
Old July 10th, 2007, 04:07 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prashant_telkar Send a message via MSN to prashant_telkar Send a message via Yahoo to prashant_telkar
Default

Warning 1 Validation (ASP.Net): Attribute 'Onchange' is not a valid attribute of element 'DropDownList'. E:\Demotestpage\Default.aspx 180 72 E:\Demotestpagehi mike i tried the code with onchange event but it gave the above warning and its not working


dont know wat to do .......help

prashant
 
Old July 11th, 2007, 01:09 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well well, I have been using this for a long time, try the below code and let us know if you are still facing problems:

<asp:DropDownList id="DropDownList1" runat="server" onchange="alert('test')">
                <asp:ListItem>First</asp:ListItem>
                <asp:ListItem>Second</asp:ListItem>
            </asp:DropDownList>

Regards
Mike

Don't expect too much, too soon.





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with trigger in registration form prashant_telkar SQL Server 2000 2 July 9th, 2007 06:52 PM
Registration Form Help invisible bunny king Classic ASP Databases 7 February 5th, 2007 05:30 PM
server registration problem pitter SQL Server 2005 2 December 30th, 2005 11:22 AM
server registration problem pitter SQL Server 2000 1 December 27th, 2005 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.