Well since controls within a datagrid do not exists until runtime you will
have to access and set the datasource in runtime in the right even and the
right event here would be "ItemDataBound" of the Datagrid. here's an
example:
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
'Get a referense to the object
Dim drpMyDropList As DropDownList =
CType(e.Item.FindControl("DropDownList1"), DropDownList)
'Set the right things to be able to bind
drpMyDropList.DataTextField = "..."
drpMyDropList.DataValueField = "..."
drpMyDropList.DataSource = 'some object
drpMyDropList.DataBind()
End Sub
Best Regards/
Lars Netzel
"Diego" <t> wrote in message news:Ox**************@TK2MSFTNGP15.phx.gbl...
I think I've understood he need to use a template column with a
DropDownBox, but I dont' how to link the ddb with the field so I let you
suggest ;).
Bye, Diego
"Lars Netzel" <ui****@adf.se> wrote in message
news:uw**************@TK2MSFTNGP12.phx.gbl... Okay, so you have a DropDownBox in a Column of a DataGrid then?
A DropDown box is always a DropDownBox with all the same Properties and
Methods.
If it is in a DataGrid the only thing that differes is that its named
dynamically and you will have to add some more code to access the right
DropDownBox just... A Good place to access the right box is in the
DataItemBound event of the DataGrid.
But you still have the DataTextField and the DataValueField to use ...
If it seems like I'm not really getting what you are asking then please
provide more detailed information abtou this.
Best Regards/
Lars Netzel
"Tan @hotmail.com>" <tannguyen88<nospam> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...I am developing a asp.net program and I want to display a dropdown box
in the details view linked to object data source
But I do not know how to display a dropdown box in thie Details view
showing the string value instead of integer
thank a lot
Tan
"Lars Netzel" <ui****@adf.se> wrote in message
news:eZ*************@TK2MSFTNGP09.phx.gbl...
???
Very little to go on here but ok.. please add code to these kind of
questions.
If you are infact binding the DropDownbox from a datasource.. then just
set the DateValueField to the name of that field in the datasource.
But since you are using the word "ComboBox".. are you using ASP or
Windows Forms (This is the ASP.NET forum you know... so the question
might be in the wrong place)?
/Lars
"Tan @hotmail.com>" <tannguyen88<nospam> wrote in message
news:uA**************@TK2MSFTNGP09.phx.gbl...
> Hello Everyone
> Need help!
>
> I have a object with the integer property that represent the address
> type. I like to show a combo box in the grid linked to an object data
> source displaying the string value instead of integer value.
>
> any help would very much appriciated
>
> Tan
>