|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
making a dropdownlist visible when clicking in a textbox of a detailsview?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é 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) Show quoteHide quote "André" <sd***@sds.sdf> wrote in message news:ugeUz%236kGHA.3720@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.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é > > > > Ok thanks
Show quoteHide quote "bruce barker (sqlwork.com)" <b_r_u_c_e_removeundersco***@sqlwork.com> wrote in message news:%23qGA9e7kGHA.2280@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:ugeUz%236kGHA.3720@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.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é > > > > > > > > > >
how to get the text in JS of a cell created on server?
can get forecolor but not background color in Javascript Retrieving Asp.treeview checked checkbox information Uploading to a folder outside the www ... ? FormView/Repeater/ Eval(FormView data) questions about Controls.add HyperLink control vs. Firefox Web User Controls(ascx) 1.1 VS 2.0 Gridview Header Template sorting ASP.Menu in IE6, cannot select menu item when... |
|||||||||||||||||||||||