Active Server Pages Programming (ASP)/About ASP.net DropDownlist

Advertisement


Question
QUESTION: Hi, i just wondering how can i put 5 dropdownlists by using for loop or else?? And how can i request it??
hope you understand what i'm doing below

<%   
2   
3 For i = 1 To 5   
4      tempdate = DateAdd(DateInterval.Day, 0 + i - 1, startdate)   
5      Response.Write("<tr>")   
6      Response.Write("<td style='width: 64px;background-color: #ffffcc;'>")   
7      Response.Write(Format(tempdate, "M/d") & "</td>")   
8      Response.Write("<td style='width: 65px'><img src='images/" & tempdate.DayOfWeek + 1 & ".gif' /></td>")   
9      Response.Write("<td style='width: 202px'>")   
10      
11 %>   
12
13 <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="FALSE" DataSourceID="SqlDataSource1" DataTextField="F121_01" DataValueField="F121_07">   
14          
15  </asp:DropDownList>   
16 <%   
17      Response.Write("</td>")   
18      Response.Write("</tr>")   
19 Next  




ANSWER: Hi

I understand the first part of it, but i don't understand  in dropdown area..

what are you trying to do in dropdownlist? is sqldatasource1 where the data come from? do you have a sqldatasource created?

what error you are getting

let me know so that I can give tell you what need to be modified.

-srini

---------- FOLLOW-UP ----------

QUESTION: actually, there is no error but. As you see DropDownList ID="DropDownList1", it means there are 5 dropdownlists were created but all in the same id. and i need to request each dropdownlist value.

Answer
Hi

You can put in a repeater control to get the value or

You can create a javascript for each onselect you can find which drop down and store into a local hidden variable.

Once you run thru javascript you can get the value in you code once the user submit..

Happy programming!!

=srini

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Srini Nagarajan

Expertise

I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience

Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.

©2012 About.com, a part of The New York Times Company. All rights reserved.