473,748 Members | 4,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making a dropdownlist visible when clicking in a textbox of a detailsview?

Hi,

I made a detailsview containing several fields for inserting only. I also
made a dropdownlist which is invisible at start.
Now, when clicking in a particular textbox, the dropdownlist must become
visible (in order to put the selected value of the dropdownlist into the
textbox of the detailsgrid.). I must say, the detailsview contains
textboxes, but also a checkbox.

I tried a lot of things, but i don't know which events to take:
<asp:DetailsVie w ID="DetailsView 1" runat="server"
DataSourceID="S qlDataSource1
.....
<asp:DropDownLi st ID="DropDownLis t1" runat="server"
DataSourceID="S qlDataSource2"
.....
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
....
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server"
.....
In the code-behind, i tried thinks like:
Protected Sub DetailsView1_Da taBound(ByVal sender As Object, ByVal e As
System.EventArg s) Handles DetailsView1.Da taBound
Dim a As DataControlFiel d
a = DetailsView1.Fi elds(5)

if ??? then
dropdownlist1.v isible=True
end if

End Sub

or
Protected Sub DetailsView1_It emInserting(ByV al sender As Object, ByVal e As
System.Web.UI.W ebControls.Deta ilsViewInsertEv entArgs) Handles
DetailsView1.It emInserting
Dim a As New TextBox
a = DetailsView1.Ro ws(2)
if ??? then
dropdownlist1.v isible=True
end if
End Sub

Can somebody tell me which event to take and how to check if the mouse is
clicked in the right textbox?
Thanks
André


Jun 19 '06 #1
2 3211
you must use client code for this (posting back on textbox focus so that
server side code coudl do it is not a good idea). this means you must render
the dropdown. use style commands to hide, not the visible property. then in
client onclick, change the style. pick up any book on javascript.

-- bruce (sqlwork.com)

"André" <sd***@sds.sd f> wrote in message
news:ug******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi,

I made a detailsview containing several fields for inserting only. I also
made a dropdownlist which is invisible at start.
Now, when clicking in a particular textbox, the dropdownlist must become
visible (in order to put the selected value of the dropdownlist into the
textbox of the detailsgrid.). I must say, the detailsview contains
textboxes, but also a checkbox.

I tried a lot of things, but i don't know which events to take:
<asp:DetailsVie w ID="DetailsView 1" runat="server"
DataSourceID="S qlDataSource1
....
<asp:DropDownLi st ID="DropDownLis t1" runat="server"
DataSourceID="S qlDataSource2"
....
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
...
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server"
....
In the code-behind, i tried thinks like:
Protected Sub DetailsView1_Da taBound(ByVal sender As Object, ByVal e As
System.EventArg s) Handles DetailsView1.Da taBound
Dim a As DataControlFiel d
a = DetailsView1.Fi elds(5)

if ??? then
dropdownlist1.v isible=True
end if

End Sub

or
Protected Sub DetailsView1_It emInserting(ByV al sender As Object, ByVal e
As
System.Web.UI.W ebControls.Deta ilsViewInsertEv entArgs) Handles
DetailsView1.It emInserting
Dim a As New TextBox
a = DetailsView1.Ro ws(2)
if ??? then
dropdownlist1.v isible=True
end if
End Sub

Can somebody tell me which event to take and how to check if the mouse is
clicked in the right textbox?
Thanks
André

Jun 19 '06 #2
Ok thanks

"bruce barker (sqlwork.com)" <b_************ *************@s qlwork.com> wrote
in message news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
you must use client code for this (posting back on textbox focus so that
server side code coudl do it is not a good idea). this means you must render the dropdown. use style commands to hide, not the visible property. then in client onclick, change the style. pick up any book on javascript.

-- bruce (sqlwork.com)

"André" <sd***@sds.sd f> wrote in message
news:ug******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi,

I made a detailsview containing several fields for inserting only. I also made a dropdownlist which is invisible at start.
Now, when clicking in a particular textbox, the dropdownlist must become
visible (in order to put the selected value of the dropdownlist into the
textbox of the detailsgrid.). I must say, the detailsview contains
textboxes, but also a checkbox.

I tried a lot of things, but i don't know which events to take:
<asp:DetailsVie w ID="DetailsView 1" runat="server"
DataSourceID="S qlDataSource1
....
<asp:DropDownLi st ID="DropDownLis t1" runat="server"
DataSourceID="S qlDataSource2"
....
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
...
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server"
....
In the code-behind, i tried thinks like:
Protected Sub DetailsView1_Da taBound(ByVal sender As Object, ByVal e As
System.EventArg s) Handles DetailsView1.Da taBound
Dim a As DataControlFiel d
a = DetailsView1.Fi elds(5)

if ??? then
dropdownlist1.v isible=True
end if

End Sub

or
Protected Sub DetailsView1_It emInserting(ByV al sender As Object, ByVal e
As
System.Web.UI.W ebControls.Deta ilsViewInsertEv entArgs) Handles
DetailsView1.It emInserting
Dim a As New TextBox
a = DetailsView1.Ro ws(2)
if ??? then
dropdownlist1.v isible=True
end if
End Sub

Can somebody tell me which event to take and how to check if the mouse is clicked in the right textbox?
Thanks
André


Jun 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1688
by: Murugan V via DotNetMonster.com | last post by:
Hi, i want to add the DropDownList,TextBox and Label in detailsview dynamically at runtime.At the page load, the detailsview displayed the records.when i click the edit button,these controls should be added in the detailsview above the row of edit/update/cancel button.when i select the dropdownlist,the selected items should be displayed in the label text.For example, Label TextBox DropDownList ------------------------------ One |...
2
2023
by: jason | last post by:
Pardon my ignorance on this. The below code works, except, when I edit a record and update the two drop downs take the first entry in the dropdownlist if not selected. I'd also like the dropdown to show the current value in edit mode. I'm sure this is a common question. I've reviewed several related post and tried them out to no avial. Some of the offerings in listgroup look right on, but are not clear on where to handle the suggested...
4
4493
by: P. Yanzick | last post by:
Hello, I've been playing with master/detail views as well as editing in the gridview, and I ran across a strange problem that I am not exactly sure where to go to try to solve. I have 2 tables, a table of cars (pretty basic, an ID, a description, and a Color ID) and a table of colors (Color ID, and a color description). I've added a gridview and a detailsview as I'm playing with both and how to get editing features to work the way I...
1
3153
by: SP | last post by:
Hello there, I have a DataList create as below. <asp:DataList ID="dl_Immunpsuppressive_Main" Runat="server" Width="100%"> <ItemTemplate> <table id="Immunpsuppressive_Main" width="100%" border="0"> <tr> <td class="sub" width="50%" colSpan="2">
0
1372
by: Dossman | last post by:
I am somewhat new to ASP.NET. Classic ASP/SQL Server experience mostly. I have a DetailsView control with a DropDownList on an EditItemTemplate. The DropdownList shows in place of a bound Textbox. The idea is to show the user the data in a bound textbox field, but show a dropdownlist on Edit. The Dropdownlists' datasource is the vw_aspnet_membershipUsers table in the database showing only the username field. The selected data needs to go...
2
1781
by: teddymeu | last post by:
Hi Guys, this is kinda complicated but ill do my best to explain. I have two tables. products and categories. Products holds product info and an image, its primary key is ProductID. Category table holds a category name and description and a primary key CategoryID. The producs table holds a Foreign key field called CategoryID which points to the CategoryID Primary key of the catgory table. Ok i have two asp.net 2 vb forms. One is using a...
2
9959
by: sree reddy | last post by:
..cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls;
0
1476
by: Dan | last post by:
Hi, I have a detailsview with two fields: in editmode, one is a textbox and the other is a dropdownlist. i want to update both fields using the detailsview. My problem: when clicking on the edit button, the modified text in the textbox is effectively updated in the table, but instead of updating the chosen value of the dropdownlist, the field in the table becomes empty (old value is updated by nothing). The items of the dropdownlist...
3
1703
by: EdisonCPP | last post by:
Hi, I have a DetailsView with a template field with a dropdownlist added to it. If the data coming into that field were put into a textbox, it would look like: Small|Medium|Large|X-Large. I need to break that out into dropdownlistitems with each text being the value also. I've tried using a ObjectDataSource unsuccesfully. What would be a valid way of handling this?
0
8991
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
9544
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
9372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4606
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
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
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
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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.