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

Discussion in 'ASP .Net Web Controls' started by André, Jun 19, 2006.

  1. André

    André Guest

    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.DetailsViewInsertEventArgs) 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é
     
    André, Jun 19, 2006
    #1
    1. Advertising

  2. 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é" <> wrote in message
    news:ugeUz%...
    > 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.DetailsViewInsertEventArgs) 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é
    >
    >
    >
    >
     
    bruce barker \(sqlwork.com\), Jun 19, 2006
    #2
    1. Advertising

  3. André

    André Guest

    Ok thanks

    "bruce barker (sqlwork.com)" <> wrote
    in message news:%...
    > 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é" <> wrote in message
    > news:ugeUz%...
    > > 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.DetailsViewInsertEventArgs) 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é
    > >
    > >
    > >
    > >

    >
    >
     
    André, Jun 20, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Murugan V via DotNetMonster.com

    How to add the DropDownList and TextBox Control in DetailsView

    Murugan V via DotNetMonster.com, Jan 8, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    667
    Murugan V via DotNetMonster.com
    Jan 8, 2005
  2. André
    Replies:
    2
    Views:
    5,238
    André
    Jun 20, 2006
  3. Dan
    Replies:
    0
    Views:
    937
  4. Dan
    Replies:
    0
    Views:
    376
  5. Jurjen de Groot
    Replies:
    0
    Views:
    311
    Jurjen de Groot
    May 19, 2008
Loading...

Share This Page