473,329 Members | 1,484 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,329 software developers and data experts.

Dropdownlist ASP

I have the following code:

<asp:DropDownList id="Dropdownlist1" runat="server">

<asp:ListItem value="N" text=DateTime.Now.ToLongDateString() />
<asp:ListItem value="S" text="Sweden" />
<asp:ListItem value="F" text="France" />
<asp:ListItem value="I" text="Italy" />
</asp:DropDownList>

Why I don't see the date as the first value of my textbox? Instead I
see "DateTime.Now.ToLongDateString()" as first value.

Thanks
Marios Koumides

Nov 19 '05 #1
5 2002
try this:

<asp:ListItem value="N" text='<%=DateTime.Now.ToLongDateString()%>' />
<ko******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have the following code:

<asp:DropDownList id="Dropdownlist1" runat="server">

<asp:ListItem value="N" text=DateTime.Now.ToLongDateString() />
<asp:ListItem value="S" text="Sweden" />
<asp:ListItem value="F" text="France" />
<asp:ListItem value="I" text="Italy" />
</asp:DropDownList>

Why I don't see the date as the first value of my textbox? Instead I
see "DateTime.Now.ToLongDateString()" as first value.

Thanks
Marios Koumides

Nov 19 '05 #2
I tried it too....no luck at all..

Any ideas??

Grant Merwitz wrote:
try this:

<asp:ListItem value="N" text='<%=DateTime.Now.ToLongDateString()%>' />

<ko******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have the following code:

<asp:DropDownList id="Dropdownlist1" runat="server">

<asp:ListItem value="N" text=DateTime.Now.ToLongDateString() />
<asp:ListItem value="S" text="Sweden" />
<asp:ListItem value="F" text="France" />
<asp:ListItem value="I" text="Italy" />
</asp:DropDownList>

Why I don't see the date as the first value of my textbox? Instead I see "DateTime.Now.ToLongDateString()" as first value.

Thanks
Marios Koumides


Nov 19 '05 #3
ok, take out the fist list item,
and in your code write

Dropdownlist1.Items.Add(DateTime.Now.ToLongDateStr ing());
<ko******@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
I tried it too....no luck at all..

Any ideas??

Grant Merwitz wrote:
try this:

<asp:ListItem value="N" text='<%=DateTime.Now.ToLongDateString()%>'

/>


<ko******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
>I have the following code:
>
> <asp:DropDownList id="Dropdownlist1" runat="server">
>
> <asp:ListItem value="N" text=DateTime.Now.ToLongDateString() />
> <asp:ListItem value="S" text="Sweden" />
> <asp:ListItem value="F" text="France" />
> <asp:ListItem value="I" text="Italy" />
> </asp:DropDownList>
>
> Why I don't see the date as the first value of my textbox? Instead I > see "DateTime.Now.ToLongDateString()" as first value.
>
> Thanks
> Marios Koumides
>

Nov 19 '05 #4
Is there a way to do it directly from the .aspx page? without having a
..vb file with code?

Nov 19 '05 #5
you don't have to use a .vb file to do code.
you can also do it within the .aspx page.

like so:

<@page language="c#" ... %>
<HTML>
<HEAD>
<SCRIPT runat=server>
void Page_Load(object Sender, EventArgs e)
{
DropdownList1.Items.Add(DateTime.Now.ToLongDateStr ing());
}
</SCRIPT>
</HEAD>
<BODY>
<form runat=server>
<asp:DropDownList id="Dropdownlist1" runat="server">
<asp:ListItem value="S" text="Sweden" />
<asp:ListItem value="F" text="France" />
<asp:ListItem value="I" text="Italy" />
</asp:DropDownList>
</form>
</BODY>
</HTML>

Other than that, i'm not sure how to directly do it into the dropdownlist
without using code.
But there must be some way.
If your adiment about that, i suggest you start a new post to get some other
people's ideas. Specify that you do not want to use script to do it.

<ko******@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Is there a way to do it directly from the .aspx page? without having a
.vb file with code?

Nov 19 '05 #6

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

Similar topics

12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
2
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of...
2
by: Shiju Poyilil | last post by:
Hello, I have a datagrid with only one row and its having 2 dropdownlists, I need to populate the secodn dropdownlist on the basis of the selection in the first dropdown. but I am not able to...
10
by: Sacha Korell | last post by:
I'm trying to load a drop-down list with all DropDownList control names from another page. How would I be able to find those DropDownList controls? The FindControl method will only find a...
15
by: glenn | last post by:
Hi folks, I have a DropDownList in a DataGrid that is populated from records in a database. I want to add a value that might be a string such as "Select a Company" for the first item since an...
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
1
by: Brett | last post by:
I have a DropDownList in an ASP.NET web form that is populated with items from a lookup table by binding that DropDownList to a SqlDataSource. However, the items in the lookup table can change over...
0
by: asmx126453 | last post by:
Hey mensen I am having some big troubles here i tryd solving it myself with internet for 2 days but i kind fix it. Its about this i have a DotNet project that alrydi is online and working for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.