473,473 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Create 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:DetailsView ID="DetailsView1" runat="server"
DataSourceID="SqlDataSource1
.....
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource2"
.....
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
....
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
.....
In the code-behind, i tried thinks like:
Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DetailsView1.DataBound
Dim a As DataControlField
a = DetailsView1.Fields(5)

if ??? then
dropdownlist1.visible=True
end if

End Sub

or
Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewInsertEventAr gs) Handles
DetailsView1.ItemInserting
Dim a As New TextBox
a = DetailsView1.Rows(2)
if ??? then
dropdownlist1.visible=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 3190
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.sdf> wrote in message
news:ug****************@TK2MSFTNGP03.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:DetailsView ID="DetailsView1" runat="server"
DataSourceID="SqlDataSource1
....
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource2"
....
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
...
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
....
In the code-behind, i tried thinks like:
Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DetailsView1.DataBound
Dim a As DataControlField
a = DetailsView1.Fields(5)

if ??? then
dropdownlist1.visible=True
end if

End Sub

or
Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e
As
System.Web.UI.WebControls.DetailsViewInsertEventAr gs) Handles
DetailsView1.ItemInserting
Dim a As New TextBox
a = DetailsView1.Rows(2)
if ??? then
dropdownlist1.visible=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_*************************@sqlwork.com> wrote
in message news:%2****************@TK2MSFTNGP02.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.sdf> wrote in message
news:ug****************@TK2MSFTNGP03.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:DetailsView ID="DetailsView1" runat="server"
DataSourceID="SqlDataSource1
....
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource2"
....
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
...
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
....
In the code-behind, i tried thinks like:
Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DetailsView1.DataBound
Dim a As DataControlField
a = DetailsView1.Fields(5)

if ??? then
dropdownlist1.visible=True
end if

End Sub

or
Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e
As
System.Web.UI.WebControls.DetailsViewInsertEventAr gs) Handles
DetailsView1.ItemInserting
Dim a As New TextBox
a = DetailsView1.Rows(2)
if ??? then
dropdownlist1.visible=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
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...
2
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...
4
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...
1
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%"...
0
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....
2
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...
2
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
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...
3
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...
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
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...
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...
1
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
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,...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.