473,570 Members | 2,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

additional Values in ListItem (DropDownList)

Hello all,

I'm thinking about overwriting the ListItem, so it can
contain x additional values (not only one).
Has anybody ever tried this?
Has someone got an example (C#)?
Can DropDownList handle overwritten Items, or will
additional Data be lost?

Thanks for any advice.

Sebi
Nov 18 '05 #1
6 4432
You can write function which fills the dropdownlist
Inside this function add all additional values you want.
All you must remember is to use this function
For example

void BindCombo(Dropd ownlist Combo, DataTable Data, string TextField, string
ValueField, bool ShowDefaultItem )
{
Combo.DataSourc e = Data;

Combo.DataValue Field = ValueField;

Combo.DataTextF ield = TextField;

Combo.DataBind( );

if(ShowDefaultI tem)

{

Combo.Items.Ins ert(0, new System.Web.UI.W ebControls.List Item("My default
Item Text", "My Default Item Value"));

}
}
HTH

"Sebi" <an*******@disc ussions.microso ft.com> wrote in message
news:03******** *************** *****@phx.gbl.. .
Hello all,

I'm thinking about overwriting the ListItem, so it can
contain x additional values (not only one).
Has anybody ever tried this?
Has someone got an example (C#)?
Can DropDownList handle overwritten Items, or will
additional Data be lost?

Thanks for any advice.

Sebi

Nov 18 '05 #2
Soory! Didnt express myself corect!

I mean more than Text and Value P E R I T E M!
(so in the end I can Fill like this:
Combo.DataSourc e = Data;
Combo.DataValue Field[1] = ValueField;
Combo.DataValue Field[2]= SecondValueFiel d;
Combo.DataValue Field[3]= ThirdValueField ;
Nov 18 '05 #3
But finally dropdown will be rendered as <select> tag in HTML
Items rendered as <option value='Value'>T ext</option>
Where do you put additional items members and why you need them?

<an*******@disc ussions.microso ft.com> wrote in message
news:0a******** *************** *****@phx.gbl.. .
Soory! Didnt express myself corect!

I mean more than Text and Value P E R I T E M!
(so in the end I can Fill like this:
Combo.DataSourc e = Data;
Combo.DataValue Field[1] = ValueField;
Combo.DataValue Field[2]= SecondValueFiel d;
Combo.DataValue Field[3]= ThirdValueField ;
.
.
.
Combo.DataTextF ield = TextField;
Combo.DataBind( );
)

-----Original Message-----
You can write function which fills the dropdownlist
Inside this function add all additional values you want.
All you must remember is to use this function
For example

void BindCombo(Dropd ownlist Combo, DataTable Data,

string TextField, string
ValueField, bool ShowDefaultItem )
{
Combo.DataSour ce = Data;

Combo.DataValu eField = ValueField;

Combo.DataText Field = TextField;

Combo.DataBind ();

if(ShowDefault Item)

{

Combo.Items.In sert(0, new

System.Web.UI.W ebControls.List Item("My default
Item Text", "My Default Item Value"));

}
}
HTH

"Sebi" <an*******@disc ussions.microso ft.com> wrote in

message
news:03******* *************** ******@phx.gbl. ..
Hello all,

I'm thinking about overwriting the ListItem, so it can
contain x additional values (not only one).
Has anybody ever tried this?
Has someone got an example (C#)?
Can DropDownList handle overwritten Items, or will
additional Data be lost?

Thanks for any advice.

Sebi

.

Nov 18 '05 #4
Thats Right,
need to overwrite the rendering! That's what I've never
done until now and what I'm searching a sample for.

My Application is Database-based, in the ComboBox I show
Name as Text and have ID stored as Value.
Now I'm having associated Data Like a Prefix witch
should be shown in a Text Box after a selection.
Because I want this to work faster I want to store this
Prefix in the ComboBox.

S
-----Original Message-----
But finally dropdown will be rendered as <select> tag in HTMLItems rendered as <option value='Value'>T ext</option>
Where do you put additional items members and why you need them?
<an*******@dis cussions.micros oft.com> wrote in message
news:0a******* *************** ******@phx.gbl. ..
Soory! Didnt express myself corect!

I mean more than Text and Value P E R I T E M!
(so in the end I can Fill like this:
Combo.DataSourc e = Data;
Combo.DataValue Field[1] = ValueField;
Combo.DataValue Field[2]= SecondValueFiel d;
Combo.DataValue Field[3]= ThirdValueField ;
.
.
.
Combo.DataTextF ield = TextField;
Combo.DataBind( );
)

>-----Original Message-----
>You can write function which fills the dropdownlist
>Inside this function add all additional values you want. >All you must remember is to use this function
>For example
>
>void BindCombo(Dropd ownlist Combo, DataTable Data,

string TextField, string
>ValueField, bool ShowDefaultItem )
>{
>Combo.DataSour ce = Data;
>
>Combo.DataValu eField = ValueField;
>
>Combo.DataText Field = TextField;
>
>Combo.DataBind ();
>
>if(ShowDefault Item)
>
>{
>
>Combo.Items.In sert(0, new

System.Web.UI.W ebControls.List Item("My default
>Item Text", "My Default Item Value"));
>
>}
>
>
>}
>HTH
>
>"Sebi" <an*******@disc ussions.microso ft.com> wrote in

message
>news:03******* *************** ******@phx.gbl. ..
>> Hello all,
>>
>> I'm thinking about overwriting the ListItem, so it can >> contain x additional values (not only one).
>> Has anybody ever tried this?
>> Has someone got an example (C#)?
>> Can DropDownList handle overwritten Items, or will
>> additional Data be lost?
>>
>> Thanks for any advice.
>>
>> Sebi
>
>
>.
>

.

Nov 18 '05 #5
SSW
U can concatinate all the values and store as Values(of <option
value='Value'>T ext</option>). Then u can process this value part of Dropdown
string vai JavaScript Or on Server(VB/C#). Up to u.

Second Option, Create DataTable store it in view state and Process it on
server.

Thier r many ways to achive it.
Thanks,

sswalia
MCSD, MCAD, OCA
"Sebi" <an*******@disc ussions.microso ft.com> wrote in message
news:0c******** *************** *****@phx.gbl.. .
Thats Right,
need to overwrite the rendering! That's what I've never
done until now and what I'm searching a sample for.

My Application is Database-based, in the ComboBox I show
Name as Text and have ID stored as Value.
Now I'm having associated Data Like a Prefix witch
should be shown in a Text Box after a selection.
Because I want this to work faster I want to store this
Prefix in the ComboBox.

S
-----Original Message-----
But finally dropdown will be rendered as <select> tag in

HTML
Items rendered as <option value='Value'>T ext</option>
Where do you put additional items members and why you

need them?

<an*******@dis cussions.micros oft.com> wrote in message
news:0a******* *************** ******@phx.gbl. ..
Soory! Didnt express myself corect!

I mean more than Text and Value P E R I T E M!
(so in the end I can Fill like this:
Combo.DataSourc e = Data;
Combo.DataValue Field[1] = ValueField;
Combo.DataValue Field[2]= SecondValueFiel d;
Combo.DataValue Field[3]= ThirdValueField ;
.
.
.
Combo.DataTextF ield = TextField;
Combo.DataBind( );
)


>-----Original Message-----
>You can write function which fills the dropdownlist
>Inside this function add all additional values you want. >All you must remember is to use this function
>For example
>
>void BindCombo(Dropd ownlist Combo, DataTable Data,
string TextField, string
>ValueField, bool ShowDefaultItem )
>{
>Combo.DataSour ce = Data;
>
>Combo.DataValu eField = ValueField;
>
>Combo.DataText Field = TextField;
>
>Combo.DataBind ();
>
>if(ShowDefault Item)
>
>{
>
>Combo.Items.In sert(0, new
System.Web.UI.W ebControls.List Item("My default
>Item Text", "My Default Item Value"));
>
>}
>
>
>}
>HTH
>
>"Sebi" <an*******@disc ussions.microso ft.com> wrote in
message
>news:03******* *************** ******@phx.gbl. ..
>> Hello all,
>>
>> I'm thinking about overwriting the ListItem, so it can >> contain x additional values (not only one).
>> Has anybody ever tried this?
>> Has someone got an example (C#)?
>> Can DropDownList handle overwritten Items, or will
>> additional Data be lost?
>>
>> Thanks for any advice.
>>
>> Sebi
>
>
>.
>

.

Nov 18 '05 #6
Also thought about concatenating, guess this is the
easiest way!

S
-----Original Message-----
U can concatinate all the values and store as Values(of <optionvalue='Value'> Text</option>). Then u can process this value part of Dropdownstring vai JavaScript Or on Server(VB/C#). Up to u.

Second Option, Create DataTable store it in view state and Process it onserver.

Thier r many ways to achive it.
Thanks,

sswalia
MCSD, MCAD, OCA
"Sebi" <an*******@disc ussions.microso ft.com> wrote in messagenews:0c******* *************** ******@phx.gbl. ..
Thats Right,
need to overwrite the rendering! That's what I've never
done until now and what I'm searching a sample for.

My Application is Database-based, in the ComboBox I show Name as Text and have ID stored as Value.
Now I'm having associated Data Like a Prefix witch
should be shown in a Text Box after a selection.
Because I want this to work faster I want to store this
Prefix in the ComboBox.

S
>-----Original Message-----
>But finally dropdown will be rendered as <select> tag in
HTML
>Items rendered as <option value='Value'>T ext</option>
>Where do you put additional items members and why you

need them?
>
><an*******@dis cussions.micros oft.com> wrote in message
>news:0a******* *************** ******@phx.gbl. ..
>> Soory! Didnt express myself corect!
>>
>> I mean more than Text and Value P E R I T E M!
>> (so in the end I can Fill like this:
>> Combo.DataSourc e = Data;
>> Combo.DataValue Field[1] = ValueField;
>> Combo.DataValue Field[2]= SecondValueFiel d;
>> Combo.DataValue Field[3]= ThirdValueField ;
>> .
>> .
>> .
>> Combo.DataTextF ield = TextField;
>> Combo.DataBind( );
>> )
>>
>>
>>
>>
>> >-----Original Message-----
>> >You can write function which fills the dropdownlist
>> >Inside this function add all additional values you

want.
>> >All you must remember is to use this function
>> >For example
>> >
>> >void BindCombo(Dropd ownlist Combo, DataTable Data,
>> string TextField, string
>> >ValueField, bool ShowDefaultItem )
>> >{
>> >Combo.DataSour ce = Data;
>> >
>> >Combo.DataValu eField = ValueField;
>> >
>> >Combo.DataText Field = TextField;
>> >
>> >Combo.DataBind ();
>> >
>> >if(ShowDefault Item)
>> >
>> >{
>> >
>> >Combo.Items.In sert(0, new
>> System.Web.UI.W ebControls.List Item("My default
>> >Item Text", "My Default Item Value"));
>> >
>> >}
>> >
>> >
>> >}
>> >HTH
>> >
>> >"Sebi" <an*******@disc ussions.microso ft.com> wrote
in >> message
>> >news:03******* *************** ******@phx.gbl. ..
>> >> Hello all,
>> >>
>> >> I'm thinking about overwriting the ListItem, so it can
>> >> contain x additional values (not only one).
>> >> Has anybody ever tried this?
>> >> Has someone got an example (C#)?
>> >> Can DropDownList handle overwritten Items, or

will >> >> additional Data be lost?
>> >>
>> >> Thanks for any advice.
>> >>
>> >> Sebi
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Nov 18 '05 #7

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

Similar topics

0
1899
by: adam | last post by:
i have custom user control and i'm trying to pass values to custom user control......I need help it seems to me i cannot pass the value to user control from dropdownlist. I have property in a control. In a default.aspx page <SkinExample:Hello id="HelloControl" SkinName="red" runat="server" /> i can pass the value, it works fine, but from the...
2
1174
by: Sean | last post by:
HI There, I would like to find out the syntax for having option values different from the ones displayed on the page? In regular HTML the forms are like <option value=1>New South Wales</option>, how can I acheive this in asp ..net? Sean !---
4
16966
by: Todd Perkins | last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually rely on google. So I hope I have enough info contained. Thank you in advance for any help! Problem: I am getting this error when I try to pull up my edit page to display the current database information in the form, and then edit it on click:
1
8532
by: osh | last post by:
All, I am having trouble using the PostBackUrl feature in .NET 2.0. I have several User Controls that are on a MasterPage. The User Controls contain the form fields for a basic search on available homes and properties in a given area. I put these form fields into User Controls because they will be repeated in different ways throughout the...
3
3770
by: Sully | last post by:
Hi, I am having a small problem generating an e-mail via an online form. I am creating an e-mail using the MailMessage command and I know that you have to do something special to render the values Checked with a CheckBoxList, but I don't know what to do or how to do it. If anyone could give me an example or send me to a link I would...
9
4660
by: Kevin Blount | last post by:
Here's the code I tried, and found it failed... <form runat="server" method="post" name="CreditCardForm" id="CreditCardForm"> <% foreach (object item in Request.Form) { if (item.ToString().IndexOf("__") != 0) { //Response.Write(item + " = " + Request.Form +
1
3175
by: RSH | last post by:
Hi, I have a situation where I need to add several "Hidden" properties to list items in a dropdownlist. By default the DropDownList item has two properties with regards to the listitems collection, Text and Value. I need to add a DivisionID, and DepartmentID. I assumed i could simply override the ListItem class and add the additional...
3
9835
by: =?Utf-8?B?ZGVuIDIwMDU=?= | last post by:
Hi, Trouble in retaining values of dropdownlist, textboxes, and other controls when dropdownlist selectedindexchanged event is triggered, the controls are inside a user control and this user control inside a parent user control with an update panel. Can you guys help me hwo to retain the values. I have set EnableViewState to true. Where is...
0
2856
by: chandrasekhar | last post by:
Hi I have developed a web page with some controls. I put all of them in session variables. I passed this values in the page. When an user enter some data in form fields and click the buttton , these values are displaying in next page.after displaying in next page, when click back button to see my entered values for change , no values are in...
0
7944
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8149
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7699
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5523
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3681
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3671
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.