473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

the real value of the combo box

Tan
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
Nov 19 '05 #1
6 1333
???

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

Nov 19 '05 #2
Tan
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


Nov 19 '05 #3
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



Nov 19 '05 #4
Hi Tan,

A dropdown box holds a list of "ListItem" objects... each listitem object
has a piece of text that it shows,
and a piece that is its corresponding "value" so you're adding the text and
value to the listitem object,
then adding it to the dropdown box.

In a loop, you can do the following:

DropDownList1.Items.Add(New ListItem(yourobject.textvalue,
yourobject.integervalue))
for each object's text and corresponding value

HTH

Mona[Grapecity]
"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

Nov 19 '05 #5
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



Nov 19 '05 #6
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
>



Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: middletree | last post by:
Some posters here have occasionally used the term combo to refer to <select> form elements. If you have any VB background, you know that a true combo box is a dropdown with prefilled values, but...
2
by: Terry Bickle | last post by:
Please forgive me for using the wrong term here or there. I'm an old Excel 4 macro guy who didn't convert to VB and I'm tinkering with an Access 2000 DB. I'm sure there is a simple Access 101...
8
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
1
by: meganrobertson22 | last post by:
Hi Everyone- I am trying to use a simple macro to set the value of a combo box on a form, and I can't get it to work. I have a macro with 2 actions: OpenForm and SetValue. I can open my form,...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
20
by: MLH | last post by:
120 MyString = "How many copies of each letter do you need?" 150 MyVariant = InputBox(MyString, "How Many?", "3") If MyVariant = "2" Then MsgBox "MyVariant equals the string '2'" If...
4
by: Torilyn73 | last post by:
I have a combo box set up off a query. I want the default value to be the column heading so I don't have to put a label over it. So far I haven't been able to figure this out. Can anyone tell me if...
9
by: oriondcv | last post by:
hi, please help me on this issue that im facing... I have created a filtered combo box in ms access. It works but the value it inputs in the database is the primary key value like in my program...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.