473,414 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Hidden Dropdownlist won't insert value into record

I have a dropdownlist that is populated with a staffID number depending on the staff members name that is selected from a second dropdownlist. The value from this dropdownlist is then inserted into a new record when the page is submit using the InsertQuery of an sqlDataSource.

This works fine, however I want to hide the staffID Dropdownlist so the user cannot see it on the page, if I set the .visible property to false the staffID number is not inserted into the record that column is instead null. I have tryed keeping the .visible as true and hiding it on Page_Load with the same result.

Any idea how I can hide this dropdownlist from the user while still inserting its value into the record?
Sep 20 '10 #1

✓ answered by Frinavale

Try using CSS to hide the DropDownList instead of setting it's Visible property to False. When you set the Visible Property of any control to False, it will not be rendered on the page. However, you can have the control render and still hide the control by setting it's style="display:none" or style="visibility:hidden" (the first one is what I recommend).

-Frinny

2 3007
Frinavale
9,735 Expert Mod 8TB
Try using CSS to hide the DropDownList instead of setting it's Visible property to False. When you set the Visible Property of any control to False, it will not be rendered on the page. However, you can have the control render and still hide the control by setting it's style="display:none" or style="visibility:hidden" (the first one is what I recommend).

-Frinny
Sep 20 '10 #2
Setting the dropdownlists style="display:none" worked perfectly, thanks very much!
Sep 20 '10 #3

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

Similar topics

3
by: Earl Teigrob | last post by:
I want to write a function where I pass in a reference to a dropdownlist and a "match value" and have it returns the index of the dropdownlist item that matchs (or -1 if there is no match) ...
1
by: Harry | last post by:
Hi, Just seeing if anyone can help me with a problem I am having with drop down lists. - I have a asp:dropdownlist that gets its values from a database. - The user then selects a value then...
4
by: Patrick Olurotimi Ige | last post by:
I have a DropDown Lsit set to ddlGetDebtor.Items.Insert(0, "-Select Debtor Code-") which is setting the "-Select Debtor Code-" to be default And on PostBack i'm passng:- Cmd.Parameters.Add(New...
0
by: jhonz | last post by:
I have come across a strange circumstance. I have user controls with dropdownlists that interact fine during times where the web server has minimal load. But once things pick up and postbacks...
0
by: JJ_377 | last post by:
The following doesn't assign value to the dropdownlist - WHY? ___________________________________________________________________ In a user control (ascx named USACustomer) : Public Property...
0
by: Anilsg | last post by:
Hi all, I have the DropDownList in the FormView,inside InsertTemplateField The data is binded in run time to it in codebehind page,FOr the First time the page is loaded the DropdownList...
11
by: stantron | last post by:
Setup: I only have one database with one table in it. The first page has a form that adds a record (w/ 6 fields in it) to the mySQL database's lone table via PHP. This works fine. I also have a PHP...
0
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
i have this in an Insert Template Relationship: <asp:DropDownList ID="ddlContactType" runat="server" SelectedValue='<%# Bind("IContactType") %>' DataSourceID="odsContactType"...
2
by: freefony | last post by:
Hi guys am having problems creating 3 dropdownlist controls on my form they re suppose to be "day", "month" and "year" and i want to insert this into my database as one value "date of birth" . am...
1
by: coolnavjot31 | last post by:
I have Gridview with Template Field.And I Put Dropdownlist at footer row of gridview. but when i insert the value from a database table in dropdownlist , than it generate error. for filling value ,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.