abt ddl

Reply

Join Date: Oct 2008
Posts: 5
Reputation: spr_vivega is an unknown quantity at this point 
Solved Threads: 0
spr_vivega spr_vivega is offline Offline
Newbie Poster

abt ddl

 
0
  #1
Nov 11th, 2008
hi viewers,
am vivega,i need info abt drop down list(ddl).could u plz tel me how to display date-month-year in ddl using asp.net?it's very imp n urgent.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 95
Reputation: reach_yousuf is an unknown quantity at this point 
Solved Threads: 17
reach_yousuf reach_yousuf is offline Offline
Junior Poster in Training

Re: abt ddl

 
0
  #2
Nov 11th, 2008
aspx
  1. <asp:DropDownList id="ddl1" runat="server" > </asp:DropDownList>

Code behind

  1.  
  2. ddl1.Items.Add(Format(Date.Today, "dd MMM yyyy"))

Mark as fixed if it helps you!!!
Yousuf
Software Developer
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 5
Reputation: spr_vivega is an unknown quantity at this point 
Solved Threads: 0
spr_vivega spr_vivega is offline Offline
Newbie Poster

Re: abt ddl

 
0
  #3
Nov 11th, 2008
thnx for ur reply n sorry bcoz am a fresher so i could not able to get u.could u plz tell me what it means?and my doubt is, does it generate d-m-y automatically? plz tel me any website or link related to this concept if poss. it's very imp n urgent sir.

thanks in advance,
============================================

Originally Posted by reach_yousuf View Post
aspx
  1. <asp:DropDownList id="ddl1" runat="server" > </asp:DropDownList>

Code behind

  1.  
  2. ddl1.Items.Add(Format(Date.Today, "dd MMM yyyy"))

Mark as fixed if it helps you!!!
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 95
Reputation: reach_yousuf is an unknown quantity at this point 
Solved Threads: 17
reach_yousuf reach_yousuf is offline Offline
Junior Poster in Training

Re: abt ddl

 
0
  #4
Nov 11th, 2008
if u mean explaination: then

First add an .aspx page then drag n drop ddl on page and set its property to autopostback = true. then

from design page double click the ddl its takes u to the code behind page where u will be coding. just find the Page_load event to add the
ddl1.Items.Add(Format(Date.Today, "dd MMM yyyy"))
Last edited by reach_yousuf; Nov 11th, 2008 at 9:11 am.
Yousuf
Software Developer
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 5
Reputation: spr_vivega is an unknown quantity at this point 
Solved Threads: 0
spr_vivega spr_vivega is offline Offline
Newbie Poster

Re: abt ddl

 
0
  #5
Nov 11th, 2008
sir,i did as u told but am getting 3 errors,those are:

Error 1 The name 'ddl1' does not exist in the current context
Error 2 The name 'Format' does not exist in the current context
Error 3 The name 'Date' does not exist in the current context




Originally Posted by reach_yousuf View Post
if u mean explaination: then

First add an .aspx page then drag n drop ddl on page and set its property to autopostback = true. then

from design page double click the ddl its takes u to the code behind page where u will be coding. just find the Page_load event to add the
ddl1.Items.Add(Format(Date.Today, "dd MMM yyyy"))
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 95
Reputation: reach_yousuf is an unknown quantity at this point 
Solved Threads: 17
reach_yousuf reach_yousuf is offline Offline
Junior Poster in Training

Re: abt ddl

 
0
  #6
Nov 11th, 2008
pls, c the code below

aspx page
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7. <title>Untitled Page</title>
  8. </head>
  9. <body>
  10. <form id="form1" runat="server">
  11. <div>
  12. <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  13. <asp:DropDownList id="ddl1" runat="server" AutoPostBack="True" > </asp:DropDownList>
  14. </div>
  15. </form>
  16. </body>
  17. </html>

code behind

  1. Partial Class _Default
  2. Inherits System.Web.UI.Page
  3.  
  4. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  5. ddl1.Items.Add(Format(Date.Today, "dd MMM yyyy"))
  6. End Sub
  7.  
  8. Protected Sub ddl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl1.SelectedIndexChanged
  9. TextBox1.Text = ddl1.SelectedItem.Value
  10.  
  11. End Sub
  12. End Class
Yousuf
Software Developer
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 5
Reputation: spr_vivega is an unknown quantity at this point 
Solved Threads: 0
spr_vivega spr_vivega is offline Offline
Newbie Poster

Re: abt ddl

 
0
  #7
Nov 11th, 2008
sir,thnx n i got output. But i wanted to display not the present date but i wanted d-m-y like calender.means,whatever the d-m-y we wanted,it will get selected by the user from drop down list. It may be today's date or previous or coming date I think i explained well.one more thing is i know only C#. u answered very patiently. i dont want to disturb u more.thnx.


Originally Posted by reach_yousuf View Post
pls, c the code below

aspx page
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7. <title>Untitled Page</title>
  8. </head>
  9. <body>
  10. <form id="form1" runat="server">
  11. <div>
  12. <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  13. <asp:DropDownList id="ddl1" runat="server" AutoPostBack="True" > </asp:DropDownList>
  14. </div>
  15. </form>
  16. </body>
  17. </html>

code behind

  1. Partial Class _Default
  2. Inherits System.Web.UI.Page
  3.  
  4. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  5. ddl1.Items.Add(Format(Date.Today, "dd MMM yyyy"))
  6. End Sub
  7.  
  8. Protected Sub ddl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl1.SelectedIndexChanged
  9. TextBox1.Text = ddl1.SelectedItem.Value
  10.  
  11. End Sub
  12. End Class
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum


Views: 590 | Replies: 6
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC