Thanks for your reply Ed,
So for the control display the color lists you selected from database, is
it a DataList or DetailsView control? It would be hard for me to give you
some detailed code snippet without knowing the exact control you used,
that's why I ask you give me some aspx template or snippet that will make
it much easier to understand(database schema is not that important here
since what we want to do is just get a value which is databound to display
in another control and the control structure is the most important thing
here).
I assume that your insert template( those controls that help you insert a
new record of Color) contains a Textbox to let user input Color ID, then,
you can just use the following code in Textbox's "preRender" event to
assign it the value from DropDownlist:
<<<<<<<<<<<<<<<<<<
Protected Sub TextBox1_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox1.PreRender
Dim ddl As DropDownList = Page.Form.FindControl("DropDownList1")
Dim txt As TextBox = sender
txt.Text = ddl.SelectedValue
End Sub
#again, here I assume that the DropDownlist is at top level of the page and
I use Form.FindControl to locate it. This may vary depend on the control
hierarchy
Also, as you mentioned, you may also do the updating in DropDownList's
selected index change event to refresh the TextBox's value.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Ed Dror" <edd@andrewlauren.com>
>References: <#$p5#EXfIHA.6136@TK2MSFTNGP03.phx.gbl>
<xb0g8KafIHA.6844@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: Data List Insert new problem
>Date: Tue, 4 Mar 2008 13:28:02 -0800
[quoted text clipped - 85 lines]
>>
>> Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> ications.
>>
[quoted text clipped - 50 lines]
>>>Thanks,
>>>Ed Dror
Ed Dror - 05 Mar 2008 19:09 GMT
Steven,
I try this solution but it dosen't seems to work so I changed the dropdown
to GridView with the folowing code
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles GridView1.SelectedIndexChanged
txtGNID.Text = Me.GridView1.SelectedRow.Cells(1).Text
End Sub
Then I created a form with submit botton that call Stored Proc
usp_InsertColor and it works
Thanks,
Ed Dror
> Thanks for your reply Ed,
>
[quoted text clipped - 203 lines]
>>>>Thanks,
>>>>Ed Dror
Steven Cheng - 06 Mar 2008 02:25 GMT
Hi Ed,
Thanks for your reply.
so your current solution is using GridView's SelectedIndexChanged event to
synchronize the Textbox, I think that's also a good idea.
Thanks for sharing this with us.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Ed Dror" <edd@andrewlauren.com>
>Subject: Re: Data List Insert new problem
>Date: Wed, 5 Mar 2008 11:09:45 -0800
>Steven,
>
[quoted text clipped - 157 lines]
>>>>
>>>> Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>>>> ications.
>>>>
[quoted text clipped - 58 lines]
>>>>>Thanks,
>>>>>Ed Dror