eyeguy, I know you really want to use code behind for this however sometimes using SqlDataSource in the aspx page for drop down lists is sometimes easier to do.
Not to nitpick mind you but I would suggest putting all that style stuff into a .css file and then reference to it. Drop it into a CSS directory named as mainstyle.css and then do like this:
eyeguy1
Member
2 Points
61 Posts
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:28 PM|LINK
It is removed. Still doesnt work. Hmmm????
bbcompent1
All-Star
33824 Points
8760 Posts
Moderator
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:34 PM|LINK
eyeguy, I know you really want to use code behind for this however sometimes using SqlDataSource in the aspx page for drop down lists is sometimes easier to do.
sriramabi
Contributor
4351 Points
1277 Posts
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:35 PM|LINK
hai
u can try this
pls remove autopostback="True" in second ddl
and bind second ddl inside first ddl SelectedIndexChanged event....
then no use !ispostback in second ddl bind ....
thank u
eyeguy1
Member
2 Points
61 Posts
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:43 PM|LINK
I love to do things easier. LOL!!!! The problem is I do not know all of the technical savvy to do it that way.
bbcompent1
All-Star
33824 Points
8760 Posts
Moderator
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:45 PM|LINK
Ok, I'll be back with aspx and code behind for ya.
eyeguy1
Member
2 Points
61 Posts
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:51 PM|LINK
I sure appreciate all of your help. Does the code behind need to change as well
bbcompent1
All-Star
33824 Points
8760 Posts
Moderator
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:52 PM|LINK
Yes, part has to be commented out. Here it is:
ASPX Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ECPOrder.aspx.cs" Inherits="ECPOrder" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <style type="text/css"> .style1 { width: 100%; z-index: 1; left: 0px; top: 7px; position: absolute; height: 88px; } .style3 { width: 45px; height: 23px; font-weight: bold; text-align: right; } .style4 { height: 23px; } .style5 { height: 9px; text-align: center; font-weight: bold; } .style6 { width: 45px; height: 9px; text-align: center; } .style7 { height: 9px; text-align: center; width: 61px; font-weight: bold; } .style9 { height: 23px; width: 61px; } .style10 { height: 9px; text-align: center; width: 64px; font-weight: bold; } .style12 { height: 23px; width: 64px; } .style13 { height: 9px; text-align: center; width: 59px; font-weight: bold; } .style15 { height: 23px; width: 59px; } .style16 { height: 9px; text-align: center; width: 55px; font-weight: bold; } .style18 { height: 23px; width: 55px; } .style22 { height: 9px; text-align: center; width: 80px; font-weight: bold; } .style24 { height: 23px; width: 80px; } .style25 { height: 9px; text-align: center; width: 62px; font-weight: bold; } .style27 { height: 23px; width: 62px; } .style28 { height: 9px; text-align: center; width: 78px; font-weight: bold; } .style30 { height: 23px; width: 78px; } .style31 { height: 9px; text-align: center; width: 76px; font-weight: bold; } .style33 { height: 23px; width: 76px; } .style34 { width: 100%; } .style37 { width: 46px; font-weight: 700; text-align: right; } .style38 { width: 144px; } .style40 { width: 46px; font-weight: 700; text-align: right; height: 23px; } .style41 { width: 144px; height: 23px; } .style43 { height: 23px; width: 60px; text-align: center; } .style44 { width: 60px; } .style45 { height: 23px; width: 70px; } .style46 { width: 70px; } .style47 { height: 23px; text-align: center; } .style48 { height: 23px; width: 66px; text-align: center; } .style49 { width: 66px; } .style50 { height: 23px; text-align: center; width: 85px; } .style51 { width: 85px; } .style52 { width: 45px; height: 14px; font-weight: bold; text-align: right; } .style53 { height: 14px; width: 64px; } .style54 { height: 14px; width: 61px; } .style55 { height: 14px; width: 55px; } .style56 { height: 14px; width: 59px; } .style57 { height: 14px; width: 80px; } .style58 { height: 14px; width: 62px; } .style59 { height: 14px; width: 78px; } .style60 { height: 14px; width: 76px; } .style61 { height: 14px; } .style62 { color: #FFFFFF; } </style> </head> <body> <form id="form1" runat="server"> <div> <asp:Panel ID="Panel16" runat="server" style="z-index: 1; left: 76px; top: 23px; position: absolute; height: 130px; width: 1027px"> <asp:Label ID="Label23" runat="server" style="z-index: 1; left: 0px; top: 2px; position: absolute; width: 638px; height: 42px;" Text="Value Vision Optical, LLC" Font-Bold="True" Font-Italic="True" Font-Size="XX-Large" ForeColor="#006699"></asp:Label> <asp:Label ID="Label24" runat="server" Font-Italic="True" ForeColor="Maroon" style="z-index: 1; left: 137px; top: 42px; position: absolute" Text=""Get more Value for your Vision""></asp:Label> <asp:Label ID="Label25" runat="server" Font-Size="XX-Large" style="z-index: 1; left: 123px; position: absolute; width: 768px; text-align: center; top: 80px; font-size: xx-large; color: #003366;" Text="Eye Care Provider Portal"></asp:Label> </asp:Panel> </div> <a target="_blank" href="http://www.website-hit-counters.com/basic-hit-counters.html"> <asp:Panel ID="Panel4" runat="server" style="z-index: 0; left: 72px; top: 168px; position: absolute; height: 29px; width: 1159px; background-color: #003366;"> <asp:HyperLink ID="HyperLink2" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="http://www.valuevisionoptical.com/AboutUs.aspx" Style="z-index: 1; left: 131px; top: 3px; position: absolute">About Value Vision Optical</asp:HyperLink> <asp:HyperLink ID="HyperLink4" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="http://www.valuevisionoptical.com/Frames.aspx" Style="z-index: 1; left: 473px; top: 3px; position: absolute">Eyewear Frames</asp:HyperLink> <asp:HyperLink ID="HyperLink3" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="http://www.valuevisionoptical.com/ContactLensList.aspx" Style="z-index: 1; left: 338px; top: 3px; position: absolute">Contact Lenses</asp:HyperLink> <asp:HyperLink ID="HyperLink7" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="http://www.valuevisionoptical.com/Accessories.aspx" Style="z-index: 1; left: 941px; top: 3px; position: absolute">Accessories</asp:HyperLink> <asp:HyperLink ID="HyperLink5" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" Style="z-index: 1; left: 623px; top: 3px; position: absolute" NavigateUrl="http://www.valuevisionoptical.com/LensList.aspx">Prescription Lenses</asp:HyperLink> <asp:HyperLink ID="HyperLink6" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="http://www.valuevisionoptical.com/Treatments.aspx" Style="z-index: 1; left: 789px; top: 3px; position: absolute">Lens Treatments</asp:HyperLink> <asp:HyperLink ID="HyperLink8" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="http://www.valuevisionoptical.com/ContactUs.aspx" Style="z-index: 1; left: 1062px; top: 3px; position: absolute; width: 150px">Contact Us</asp:HyperLink> <asp:HyperLink ID="HyperLink1" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="http://www.valuevisionoptical.com/Homepage.aspx" Style="z-index: 1; left: 32px; top: 3px; position: absolute; right: 1055px;">Homepage</asp:HyperLink> <a href="http://www.website-hit-counters.com/basic-hit-counters.html" target="_blank"> <asp:Image ID="Image3" runat="server" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 2; left: 117px; top: 0px; position: absolute; width: 3px; right: 1039px; height: 26px;" /> <asp:Image ID="Image4" runat="server" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 2; left: 325px; top: 0px; position: absolute; width: 3px; right: 831px; height: 26px;" /> <asp:Image ID="Image5" runat="server" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 2; left: 921px; top: 0px; position: absolute; width: 3px; right: 235px; height: 26px;" /> <asp:Image ID="Image6" runat="server" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 2; left: 1037px; top: 0px; position: absolute; width: 3px; right: 119px; height: 26px;" /> <asp:Image ID="Image7" runat="server" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 2; left: 772px; top: 0px; position: absolute; width: 3px; right: 384px; height: 26px;" /> <asp:Image ID="Image8" runat="server" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 2; left: 603px; top: 0px; position: absolute; width: 3px; right: 553px; height: 26px;" /> <asp:Image ID="Image9" runat="server" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 2; left: 457px; top: 0px; position: absolute; width: 3px; right: 699px; height: 26px;" /> </a> </asp:Panel> </a> <asp:Panel ID="Panel5" runat="server" style="z-index: 1; left: 228px; top: 360px; position: absolute; height: 691px; width: 710px"> <asp:Label ID="Label1" runat="server" Text="Please Enter Patient Name" BackColor="#003366" Font-Bold="True" ForeColor="White" style="z-index: 1; left: 0px; top: 0px; position: absolute; width: 708px; height: 24px"></asp:Label> <asp:Label ID="Label2" runat="server" style="z-index: 1; left: 9px; top: 37px; position: absolute" Text="Last Name:"></asp:Label> <asp:Panel ID="Panel14" runat="server" BackColor="#003366" style="z-index: 0; left: 0px; top: -42px; position: absolute; height: 27px; width: 710px"> <span class="style62"><strong> Account Number:</strong></span> <asp:Label ID="lblAccountNumber" runat="server" Font-Bold="True" ForeColor="White" style="z-index: 1; left: 307px; top: 2px; position: absolute"></asp:Label> </asp:Panel> <asp:TextBox ID="txtLastname" runat="server" style="z-index: 1; left: 87px; top: 35px; position: absolute; width: 212px" TabIndex="2"></asp:TextBox> <asp:Label ID="Label3" runat="server" style="z-index: 1; left: 325px; top: 37px; position: absolute" Text="First Name:"></asp:Label> <asp:TextBox ID="txtFirstname" runat="server" style="z-index: 1; left: 405px; top: 35px; position: absolute" TabIndex="3"></asp:TextBox> <asp:Label ID="Label4" runat="server" BackColor="#003366" Font-Bold="True" ForeColor="White" style="z-index: 1; left: 0px; top: 77px; position: absolute; width: 708px; height: 24px; bottom: 384px" Text="Please Enter Lens Data:"></asp:Label> <asp:Panel ID="Panel6" runat="server" style="z-index: 1; left: 0px; top: 107px; position: absolute; height: 66px; width: 710px"> <asp:Label ID="Label5" runat="server" style="z-index: 1; left: 13px; top: 0px; position: absolute" Text="Job Type:"></asp:Label> <asp:Label ID="Label6" runat="server" style="z-index: 1; left: 10px; top: 30px; position: absolute">Order Lens(es):</asp:Label> <asp:RadioButtonList ID="rdoJobType" runat="server" RepeatDirection="Horizontal" style="z-index: 1; left: 131px; top: -3px; position: absolute; height: 27px; width: 492px" TabIndex="4"> <asp:ListItem Selected="True">Uncut</asp:ListItem> <asp:ListItem>Finish (Frame To Come)</asp:ListItem> <asp:ListItem>Finish (Supply Frame)</asp:ListItem> </asp:RadioButtonList> <asp:RadioButtonList ID="rdoOrderType" runat="server" RepeatDirection="Horizontal" style="z-index: 1; left: 131px; top: 26px; position: absolute; height: 27px; width: 477px" TabIndex="5"> <asp:ListItem Selected="True">Pair</asp:ListItem> <asp:ListItem>Right (OD) Only</asp:ListItem> <asp:ListItem>Left (OS) Only</asp:ListItem> </asp:RadioButtonList> </asp:Panel> <asp:Panel ID="Panel7" runat="server" style="z-index: 1; left: 0px; top: 179px; position: absolute; height: 69px; width: 710px"> <asp:Label ID="Label7" runat="server" Font-Bold="True" style="z-index: 1; left: 169px; top: -3px; position: absolute; width: 146px;" Text="Select Lens Material"></asp:Label> <asp:Label ID="Label8" runat="server" Font-Bold="True" style="z-index: 1; left: 483px; top: -2px; position: absolute" Text="Select Lens Style"></asp:Label> <asp:Label ID="Label9" runat="server" style="z-index: 1; left: 5px; top: 20px; position: absolute" Text="Please Select Material:"></asp:Label> <asp:DropDownList ID="cboODMaterial" runat="server" OnSelectedIndexChanged="btnSelectOD_Click" style="z-index: 1; left: 168px; top: 18px; position: absolute; width: 143px; height: 22px" TabIndex="6" AutoPostBack="True"> <asp:ListItem Value="1">CR-39</asp:ListItem> <asp:ListItem Value="2">Polycarbonate</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="cboODStyle" runat="server" style="z-index: 1; left: 409px; top: 17px; position: absolute; width: 248px" TabIndex="7" DataSourceID="dsLensTypes" DataTextField="Description" DataValueField="LensID"> </asp:DropDownList> <asp:SqlDataSource ID="dsLensTypes" runat="server" ConnectionString="<%$ ConnectionStrings:ValueVision %>" SelectCommand="SELECT [LensID], [Description] FROM [ECPLensType1] WHERE ([LensID] = @LensID)"> <SelectParameters> <asp:ControlParameter ControlID="cboODMaterial" Name="LensID" PropertyName="SelectedValue" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> <asp:Panel ID="Panel13" runat="server" style="z-index: 1; left: 170px; top: -247px; position: absolute; height: 25px; width: 540px"> <asp:Label ID="lblWelcome" runat="server" Font-Italic="True" ForeColor="Maroon" style="z-index: 1; left: 68px; top: 0px; position: absolute; width: 433px; height: 22px;" Font-Size="Large"></asp:Label> <asp:Panel ID="Panel15" runat="server" BackColor="#003366" style="z-index: 0; left: -157px; top: -59px; position: absolute; height: 27px; width: 928px"> <asp:HyperLink ID="HyperLink27" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="ECPHomepage.aspx" style="z-index: 1; left: 26px; top: 3px; position: absolute">ECP Homepage</asp:HyperLink> <asp:HyperLink ID="HyperLink28" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="ECPOrder.aspx" style="z-index: 1; left: 189px; top: 3px; position: absolute">Place Job Order</asp:HyperLink> <asp:HyperLink ID="HyperLink29" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="ECPAccountBalance.aspx" style="z-index: 1; left: 356px; top: 3px; position: absolute; right: 457px">View Account</asp:HyperLink> <asp:HyperLink ID="HyperLink30" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="ECPViewOrders.aspx" style="z-index: 1; left: 501px; top: 3px; position: absolute">View Job Status</asp:HyperLink> <asp:HyperLink ID="HyperLink31" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="ECPProfile.aspx" style="z-index: 1; left: 657px; top: 3px; position: absolute">ECP Profile</asp:HyperLink> <asp:Image ID="Image24" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 3; left: 760px; top: -2px; position: absolute; height: 29px; width: 3px" /> <asp:Image ID="Image25" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 3; left: 632px; top: -2px; position: absolute; height: 29px; width: 3px; right: 293px;" /> <asp:Image ID="Image26" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 3; left: 474px; top: -2px; position: absolute; height: 29px; width: 3px" /> <asp:HyperLink ID="HyperLink32" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="~/ContactUs.aspx" style="z-index: 1; left: 783px; top: 3px; position: absolute">Customer Service</asp:HyperLink> <asp:Image ID="Image27" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 4; left: 329px; top: -2px; position: absolute; height: 29px; width: 3px" /> <asp:Image ID="Image23" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 4; left: 161px; top: -2px; position: absolute; height: 29px; width: 3px" /> </asp:Panel> </asp:Panel> <asp:Label ID="lblStyle" runat="server" style="z-index: 1; left: 724px; top: -26px; position: absolute; width: 165px"></asp:Label> <asp:Button ID="btnSelectStyle" runat="server" onclick="btnSelectStyle_Click" style="z-index: 1; left: 669px; top: 15px; position: absolute" Text="Select" /> </asp:Panel> <asp:Panel ID="Panel9" runat="server" style="z-index: 1; left: 0px; top: 265px; position: absolute; height: 99px; width: 710px"> <table class="style1"> <tr> <td class="style6"> </td> <td class="style10"> Sphere</td> <td class="style7"> Cylinder</td> <td class="style16"> Axis</td> <td class="style13"> Add</td> <td class="style22"> Dist PD</td> <td class="style25"> Near PD</td> <td class="style28"> Seg Ht</td> <td class="style31"> OC Ht</td> <td class="style5"> Base</td> </tr> <tr> <td class="style52"> R:</td> <td class="style53"> </td> <td class="style54"> <asp:TextBox ID="txtODCyl" runat="server" style="z-index: 1; left: 124px; top: 30px; position: absolute; width: 52px" TabIndex="11"></asp:TextBox> </td> <td class="style55"> <asp:TextBox ID="txtODAxis" runat="server" style="z-index: 1; left: 188px; top: 30px; position: absolute; width: 52px" TabIndex="12"></asp:TextBox> </td> <td class="style56"> <asp:TextBox ID="txtODAdd" runat="server" style="z-index: 1; left: 249px; top: 30px; position: absolute; width: 52px" TabIndex="13"></asp:TextBox> </td> <td class="style57"> <asp:TextBox ID="txtODDistPD" runat="server" style="z-index: 1; left: 322px; top: 30px; position: absolute; width: 52px" TabIndex="14"></asp:TextBox> </td> <td class="style58"> <asp:TextBox ID="txtODNearPD" runat="server" style="z-index: 1; left: 395px; top: 30px; position: absolute; width: 52px" TabIndex="15"></asp:TextBox> </td> <td class="style59"> <asp:TextBox ID="txtODSegHt" runat="server" style="z-index: 1; left: 470px; top: 30px; position: absolute; width: 52px" TabIndex="16"></asp:TextBox> </td> <td class="style60"> <asp:TextBox ID="txtODOCHt" runat="server" style="z-index: 1; left: 551px; top: 30px; position: absolute; width: 52px" TabIndex="17"></asp:TextBox> </td> <td class="style61"> <asp:TextBox ID="txtODBase" runat="server" style="z-index: 1; left: 639px; top: 30px; position: absolute; width: 52px" TabIndex="18"></asp:TextBox> </td> </tr> <tr> <td class="style3"> L:</td> <td class="style12"> <asp:TextBox ID="txtODSph" runat="server" style="z-index: 1; left: 59px; top: 30px; position: absolute; width: 52px; right: 599px" TabIndex="10"></asp:TextBox> <asp:TextBox ID="txtOSSph" runat="server" style="z-index: 1; left: 59px; top: 56px; position: absolute; width: 52px" TabIndex="19"></asp:TextBox> </td> <td class="style9"> <asp:TextBox ID="txtOSCyl" runat="server" style="z-index: 1; left: 125px; top: 56px; position: absolute; width: 52px; right: 533px" TabIndex="20"></asp:TextBox> </td> <td class="style18"> <asp:TextBox ID="txtOSAxis" runat="server" style="z-index: 1; left: 189px; top: 56px; position: absolute; width: 52px; right: 469px" TabIndex="21"></asp:TextBox> </td> <td class="style15"> <asp:TextBox ID="txtOSAdd" runat="server" style="z-index: 1; left: 249px; top: 56px; position: absolute; height: 22px; width: 52px" TabIndex="22"></asp:TextBox> </td> <td class="style24"> <asp:TextBox ID="txtOSDistPD" runat="server" style="z-index: 1; left: 322px; top: 56px; position: absolute; width: 52px" TabIndex="23"></asp:TextBox> </td> <td class="style27"> <asp:TextBox ID="txtOSNearPD" runat="server" style="z-index: 1; left: 396px; top: 56px; position: absolute; width: 52px" TabIndex="24"></asp:TextBox> </td> <td class="style30"> <asp:TextBox ID="txtOSSegHt" runat="server" style="z-index: 1; left: 471px; top: 56px; position: absolute; width: 52px" TabIndex="25"></asp:TextBox> </td> <td class="style33"> <asp:TextBox ID="txtOSOCHt" runat="server" style="z-index: 1; left: 552px; top: 56px; position: absolute; width: 52px" TabIndex="26"></asp:TextBox> </td> <td class="style4"> <asp:TextBox ID="txtOSBase" runat="server" style="z-index: 1; left: 639px; top: 56px; position: absolute; width: 52px" TabIndex="27"></asp:TextBox> </td> </tr> </table> </asp:Panel> <asp:Panel ID="Panel10" runat="server" style="z-index: 1; left: 0px; top: 384px; position: absolute; height: 54px; width: 710px"> <table class="style34"> <tr> <td class="style40"> R:</td> <td class="style41"> <asp:DropDownList ID="cboODPrismDir1" runat="server" style="z-index: 1; left: 134px; top: 3px; position: absolute" TabIndex="29"> <asp:ListItem>In</asp:ListItem> <asp:ListItem>Out</asp:ListItem> </asp:DropDownList> <asp:TextBox ID="txtODPrism" runat="server" style="z-index: 1; left: 59px; top: 2px; position: absolute; width: 52px; right: 599px" TabIndex="28"></asp:TextBox> </td> <td class="style45"> <asp:TextBox ID="txtODPrism2" runat="server" style="z-index: 1; left: 201px; top: 3px; position: absolute; width: 52px" TabIndex="30"></asp:TextBox> </td> <td class="style4"> <asp:DropDownList ID="cboODPrismDir2" runat="server" style="z-index: 1; left: 275px; top: 3px; position: absolute" TabIndex="31"> <asp:ListItem>Up</asp:ListItem> <asp:ListItem>Down</asp:ListItem> </asp:DropDownList> </td> <td class="style4"> </td> <td class="style48"> <asp:Label ID="Label21" runat="server" BackColor="#003366" Font-Bold="True" ForeColor="White" style="z-index: 1; left: 375px; top: -27px; position: absolute; width: 333px; height: 27px; text-align: left" Text="Frame Data"></asp:Label> A</td> <td class="style43"> B</td> <td class="style47"> ED</td> <td class="style50"> DBL</td> <td class="style4"> </td> </tr> <tr> <td class="style37"> L:</td> <td class="style38"> <asp:DropDownList ID="cboOSPrismDir1" runat="server" style="z-index: 1; left: 134px; top: 26px; position: absolute; right: 529px" TabIndex="33"> <asp:ListItem>In</asp:ListItem> <asp:ListItem>Out</asp:ListItem> </asp:DropDownList> <asp:TextBox ID="txtOSPrism" runat="server" style="z-index: 1; left: 58px; top: 26px; position: absolute; width: 52px" TabIndex="32"></asp:TextBox> </td> <td class="style46"> <asp:TextBox ID="txtOSPrism2" runat="server" style="z-index: 1; left: 201px; top: 28px; position: absolute; width: 52px" TabIndex="34"></asp:TextBox> </td> <td> <asp:DropDownList ID="cboOSPrismDir2" runat="server" style="z-index: 1; left: 275px; top: 28px; position: absolute" TabIndex="35"> <asp:ListItem>Up</asp:ListItem> <asp:ListItem>Down</asp:ListItem> </asp:DropDownList> </td> <td> </td> <td class="style49"> <asp:TextBox ID="txtA" runat="server" style="z-index: 1; left: 371px; top: 28px; position: absolute; width: 52px" TabIndex="36"></asp:TextBox> </td> <td class="style44"> <asp:TextBox ID="txtB" runat="server" style="z-index: 1; left: 438px; top: 28px; position: absolute; width: 52px; right: 220px" TabIndex="37"></asp:TextBox> </td> <td> <asp:TextBox ID="txtED" runat="server" style="z-index: 1; left: 508px; top: 28px; position: absolute; width: 52px; right: 150px" TabIndex="38"></asp:TextBox> </td> <td class="style51"> <asp:TextBox ID="txtDBL" runat="server" style="z-index: 1; left: 591px; top: 28px; position: absolute; width: 52px" TabIndex="39"></asp:TextBox> </td> <td> </td> </tr> </table> </asp:Panel> <asp:Panel ID="Panel11" runat="server" style="z-index: 1; left: 0px; top: 448px; position: absolute; height: 363px; width: 710px"> <asp:RadioButtonList ID="rdoMountType" runat="server" style="z-index: 1; left: 10px; top: 38px; position: absolute; height: 27px; width: 190px; right: 510px;" TabIndex="40"> <asp:ListItem Selected="True">Zyl ($7.99)</asp:ListItem> <asp:ListItem>Metal ($7.99)</asp:ListItem> <asp:ListItem>Semi-Rimless ($12.99)</asp:ListItem> <asp:ListItem>Rimless ($25.99)</asp:ListItem> <asp:ListItem>Wrap Frame (15.99)</asp:ListItem> </asp:RadioButtonList> <asp:Label ID="Label11" runat="server" Font-Bold="True" Font-Underline="True" style="z-index: 1; left: 48px; top: 16px; position: absolute; width: 72px" Text="Mount"></asp:Label> <asp:Label ID="Label12" runat="server" Font-Bold="True" Font-Underline="True" style="z-index: 1; left: 188px; top: 16px; position: absolute" Text="Thickness"></asp:Label> <asp:RadioButtonList ID="rdoThickness" runat="server" style="z-index: 1; left: 180px; top: 36px; position: absolute; height: 27px; width: 179px" TabIndex="41"> <asp:ListItem Selected="True">Standard Thickness</asp:ListItem> <asp:ListItem>Industrial 3.0 ($5.99)</asp:ListItem> </asp:RadioButtonList> <asp:Label ID="Label13" runat="server" Font-Bold="True" Font-Underline="True" style="z-index: 1; left: 366px; top: 16px; position: absolute" Text="Tinting"></asp:Label> <asp:Label ID="Label14" runat="server" Font-Bold="True" Font-Underline="True" style="z-index: 1; left: 529px; top: 16px; position: absolute; width: 175px" Text="Anti-Reflective Coating"></asp:Label> <asp:RadioButtonList ID="rdoARCoating" runat="server" style="z-index: 1; left: 527px; top: 41px; position: absolute; height: 27px; width: 225px" TabIndex="45"> <asp:ListItem Selected="True">No AR</asp:ListItem> <asp:ListItem>Standard AR ($21.99)</asp:ListItem> <asp:ListItem>ICE AR ($31.99)</asp:ListItem> <asp:ListItem>Crizal Easy (44.99)</asp:ListItem> <asp:ListItem>Crizal Alize (51.99)</asp:ListItem> <asp:ListItem>Crizal Sun ($51.99)</asp:ListItem> <asp:ListItem>Crizal Avance (57.99)</asp:ListItem> <asp:ListItem>Crizal OptiFog ($73.99)</asp:ListItem> <asp:ListItem>Kodak CleAR ($51.99)</asp:ListItem> <asp:ListItem>Hoya Super HiVision ($57.99)</asp:ListItem> </asp:RadioButtonList> <asp:RadioButtonList ID="rdoTinting" runat="server" style="z-index: 1; left: 349px; top: 37px; position: absolute; height: 27px; width: 167px" TabIndex="42"> <asp:ListItem Selected="True">No Tint</asp:ListItem> <asp:ListItem>Solid Tint ($3.99)</asp:ListItem> <asp:ListItem>Gradient Tint ($5.99)</asp:ListItem> </asp:RadioButtonList> <asp:Label ID="Label15" runat="server" style="z-index: 1; left: 310px; top: 122px; position: absolute" Text="Tint Color:"></asp:Label> <asp:DropDownList ID="cboTintColor" runat="server" style="z-index: 1; left: 386px; top: 118px; position: absolute" TabIndex="43"> <asp:ListItem>No Tint</asp:ListItem> <asp:ListItem>Black</asp:ListItem> <asp:ListItem>Gray</asp:ListItem> <asp:ListItem>Brown</asp:ListItem> <asp:ListItem>Blue</asp:ListItem> <asp:ListItem>Yellow</asp:ListItem> <asp:ListItem>Rose</asp:ListItem> </asp:DropDownList> <asp:Label ID="Label16" runat="server" style="z-index: 1; left: 275px; top: 150px; position: absolute" Text="Transmission %:"></asp:Label> <asp:DropDownList ID="cboTransmission" runat="server" style="z-index: 1; left: 387px; top: 147px; position: absolute" TabIndex="44"> <asp:ListItem>0</asp:ListItem> <asp:ListItem>10</asp:ListItem> <asp:ListItem>20</asp:ListItem> <asp:ListItem>30</asp:ListItem> <asp:ListItem>40</asp:ListItem> <asp:ListItem>50</asp:ListItem> <asp:ListItem>60</asp:ListItem> <asp:ListItem>70</asp:ListItem> <asp:ListItem>80</asp:ListItem> <asp:ListItem>90</asp:ListItem> </asp:DropDownList> <asp:Label ID="Label17" runat="server" style="z-index: 1; left: 53px; top: 264px; position: absolute" Text="Special Instructions:"></asp:Label> <asp:TextBox ID="txtSpecialInstructions" runat="server" MaxLength="250" Rows="2" style="z-index: 1; left: 183px; top: 266px; position: absolute; width: 314px; height: 45px" TabIndex="50"></asp:TextBox> <asp:Panel ID="Panel12" runat="server" style="z-index: 1; left: 317px; top: 240px; position: absolute; height: 19px; width: 143px; background-color: #CCCCCC"> <asp:CheckBox ID="cbRush" runat="server" style="z-index: 1; left: 6px; top: 0px; position: absolute; width: 143px;" Text="Rush Job ($8.00)" TabIndex="49" /> </asp:Panel> <asp:Button ID="btnSubmit" runat="server" style="z-index: 1; left: 571px; top: 326px; position: absolute" Text="Submit Order" onclick="btnSubmit_Click" TabIndex="51" /> <asp:CheckBox ID="cbUVFilter" runat="server" style="z-index: 1; left: -2px; top: 178px; position: absolute" Text="UV Filter ($4.99)" TabIndex="47" /> <asp:CheckBox ID="cbScratch" runat="server" style="z-index: 1; left: -2px; top: 202px; position: absolute" Text="Scratch Coating ($9.99)" TabIndex="48" /> <asp:CheckBox ID="cbRollPolish" runat="server" style="z-index: 1; left: -1px; top: 226px; position: absolute; width: 226px;" Text="Roll/Polish Edges ($4.99ea)" TabIndex="46" /> <asp:Label ID="lblError" runat="server" Font-Italic="True" ForeColor="Maroon" style="z-index: 1; left: 520px; top: 299px; position: absolute; width: 395px" Font-Bold="True"></asp:Label> <asp:Label ID="Label22" runat="server" BackColor="#003366" Font-Bold="True" ForeColor="White" style="z-index: 1; left: 0px; top: -10px; position: absolute; width: 708px; height: 27px" Text="Treatments and Services"></asp:Label> </asp:Panel> <asp:Label ID="Label19" runat="server" BackColor="#003366" Font-Bold="True" ForeColor="White" style="z-index: 1; left: 0px; top: 247px; position: absolute; width: 708px; height: 27px" Text="Prescription Data"></asp:Label> <asp:Label ID="Label20" runat="server" BackColor="#003366" Font-Bold="True" ForeColor="White" style="z-index: 1; left: 0px; top: 357px; position: absolute; width: 375px; height: 26px" Text="Prescribed Prism"></asp:Label> </asp:Panel> <asp:Panel ID="Panel8" runat="server" BackColor="#003366" style="z-index: 0; left: 0px; top: -92px; position: absolute; height: 27px; width: 928px"> <asp:HyperLink ID="HyperLink15" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="~/ECPHomepage.aspx" style="z-index: 1; left: 26px; top: 3px; position: absolute">ECP Homepage</asp:HyperLink> <asp:HyperLink ID="HyperLink26" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="~/ECPOrder.aspx" style="z-index: 1; left: 189px; top: 3px; position: absolute">Place Job Order</asp:HyperLink> <asp:HyperLink ID="HyperLink16" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="~/ECPAccountBalance.aspx" style="z-index: 1; left: 356px; top: 3px; position: absolute; right: 457px">View Account</asp:HyperLink> <asp:HyperLink ID="HyperLink17" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="~/ECPViewOrders.aspx" style="z-index: 1; left: 501px; top: 3px; position: absolute">View Job Status</asp:HyperLink> <asp:HyperLink ID="HyperLink18" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" NavigateUrl="~/ECPProfile.aspx" style="z-index: 1; left: 657px; top: 3px; position: absolute">ECP Profile</asp:HyperLink> <asp:Image ID="Image17" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 3; left: 760px; top: -2px; position: absolute; height: 29px; width: 3px" /> <asp:Image ID="Image18" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 3; left: 632px; top: -2px; position: absolute; height: 29px; width: 3px; right: 293px;" /> <asp:Image ID="Image19" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 3; left: 474px; top: -2px; position: absolute; height: 29px; width: 3px" /> <asp:Image ID="Image20" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 3; left: 324px; top: -2px; position: absolute; height: 29px; width: 3px" /> <asp:HyperLink ID="HyperLink19" runat="server" Font-Bold="True" Font-Underline="False" ForeColor="White" style="z-index: 1; left: 783px; top: 3px; position: absolute" NavigateUrl="~/ContactUs.aspx">Customer Service</asp:HyperLink> <asp:Image ID="Image22" runat="server" BackColor="White" ImageUrl="~/SiteImages/Design/VertLine.jpg" style="z-index: 3; left: 161px; top: -2px; position: absolute; height: 29px; width: 3px" /> </asp:Panel> </form> </body> </html>aspx.cs:
using System; using System.IO; using System.Data; using System.Configuration; using System.Collections; using System.Web.Security; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; public partial class ECPOrder : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Page.Session["Username"] == null && Page.Session["Username"] == null) { Response.Redirect("ECPLogin.aspx"); } lblWelcome.Text = "Welcome back " + Session["Username"]; lblAccountNumber.Text = Session["Username"].ToString(); //if (!IsPostBack) // LoadLensListOD(); if (!IsPostBack) btnSelectOD_Click(null, null); } protected void btnSubmit_Click(object sender, EventArgs e) { Response.Write(cboODStyle.SelectedItem.Text); Response.End(); return; string connectionString = ConfigurationManager.ConnectionStrings["ValueVision"].ConnectionString; SqlConnection conn = new SqlConnection(connectionString); SqlCommand comm; conn = new SqlConnection(connectionString); comm = new SqlCommand( "INSERT INTO OrdersDB (AccountNumber, Username, Lastname, Firstname, JobType, OrderType, ODMaterial, ODStyle, " + "ODSph, ODCyl, ODAxis, ODAdd, ODDistPD, ODNearPD, ODSegHt, ODOCHt, ODBase, " + "OSSph, OSCyl, OSAxis, OSAdd, OSDistPD, OSNearPD, OSSegHt, OSOCHt, OSBase, " + "ODPrism, ODPrismDir1, ODPrism2, ODPrismDir2, OSPrism, OSPrismDir1, OSPrism2, OSPrismDir2, A, B, ED, DBL, MountType," + "Thickness, Tinting, TintColor, Transmission, " + "ARCoating, UVCoat, ScratchCoat, RollPolish, RushJob, SpecialInstructions, Date)" + "VALUES (@AccountNumber, @Username, @Lastname, @Firstname, @JobType, @OrderType, @ODMaterial, @ODStyle," + "@ODSph, @ODCyl, @ODAxis, @ODAdd, @ODDistPD, @ODNearPD, @ODSegHt, @ODOCHt, @ODBase, " + "@OSSph, @OSCyl, @OSAxis, @OSAdd, @OSDistPD, @OSNearPD, @OSSegHt, @OSOCHt, @OSBase, " + "@ODPrism, @ODPrismDir1, @ODPrism2, @ODPrismDir2, @OSPrism, @OSPrismDir1, @OSPrism2, @OSPrismDir2, @A, @B, @ED, @DBL," + "@MountType, @Thickness, @Tinting, @TintColor, @Transmission, " + "@ARCoating, @UVCoat, @ScratchCoat, @RollPolish, @RushJob, @SpecialInstructions, @Date)", conn); //comm.Parameters.Add("@ClientID", SqlDbType.Int).Value; comm.Parameters.Add("@AccountNumber", SqlDbType.NVarChar).Value = lblAccountNumber.Text; comm.Parameters.Add("@Username", SqlDbType.NVarChar).Value = lblAccountNumber.Text; comm.Parameters.Add("@Lastname", SqlDbType.NVarChar).Value = txtLastname.Text; comm.Parameters.Add("@Firstname", SqlDbType.NVarChar).Value = txtFirstname.Text; comm.Parameters.Add("@JobType", SqlDbType.NVarChar).Value = rdoJobType.SelectedItem.Text; comm.Parameters.Add("@OrderType", SqlDbType.NVarChar).Value = rdoOrderType.SelectedItem.Text; comm.Parameters.Add("@ODMaterial", SqlDbType.NVarChar).Value = cboODMaterial.SelectedItem.Text; comm.Parameters.Add("@ODStyle", SqlDbType.NVarChar).Value = Session["lenstype"]; //comm.Parameters.Add("@OSMaterial", SqlDbType.NVarChar).Value = cboOSMaterial.SelectedItem.Text; //comm.Parameters.Add("@OSStyle", SqlDbType.NVarChar).Value = cboOSStyle.SelectedItem.Text; comm.Parameters.Add("@ODSph", SqlDbType.NVarChar).Value = txtODSph.Text; comm.Parameters.Add("@ODCyl", SqlDbType.NVarChar).Value = txtODCyl.Text; comm.Parameters.Add("@ODAxis", SqlDbType.NVarChar).Value = txtODAxis.Text; comm.Parameters.Add("@ODAdd", SqlDbType.NVarChar).Value = txtODAdd.Text; comm.Parameters.Add("@ODDistPD", SqlDbType.NVarChar).Value = txtODDistPD.Text; comm.Parameters.Add("@ODNearPD", SqlDbType.NVarChar).Value = txtODNearPD.Text; comm.Parameters.Add("@ODSegHt", SqlDbType.NVarChar).Value = txtODSegHt.Text; comm.Parameters.Add("@ODOCHt", SqlDbType.NVarChar).Value = txtODOCHt.Text; comm.Parameters.Add("@ODBase", SqlDbType.NVarChar).Value = txtODBase.Text; comm.Parameters.Add("@OSSph", SqlDbType.NVarChar).Value = txtOSSph.Text; comm.Parameters.Add("@OSCyl", SqlDbType.NVarChar).Value = txtOSCyl.Text; comm.Parameters.Add("@OSAxis", SqlDbType.NVarChar).Value = txtOSAxis.Text; comm.Parameters.Add("@OSAdd", SqlDbType.NVarChar).Value = txtOSAdd.Text; comm.Parameters.Add("@OSDistPD", SqlDbType.NVarChar).Value = txtOSDistPD.Text; comm.Parameters.Add("@OSNearPD", SqlDbType.NVarChar).Value = txtOSNearPD.Text; comm.Parameters.Add("@OSSegHt", SqlDbType.NVarChar).Value = txtOSSegHt.Text; comm.Parameters.Add("@OSOCHt", SqlDbType.NVarChar).Value = txtOSOCHt.Text; comm.Parameters.Add("@OSBase", SqlDbType.NVarChar).Value = txtOSBase.Text; comm.Parameters.Add("@ODPrism", SqlDbType.NVarChar).Value = txtODPrism.Text; comm.Parameters.Add("@ODPrismDir1", SqlDbType.NVarChar).Value = cboODPrismDir1.SelectedItem.Text; comm.Parameters.Add("@ODPrism2", SqlDbType.NVarChar).Value = txtODPrism2.Text; comm.Parameters.Add("@ODPrismDir2", SqlDbType.NVarChar).Value = cboODPrismDir2.SelectedItem.Text; comm.Parameters.Add("@OSPrism", SqlDbType.NVarChar).Value = txtOSPrism.Text; comm.Parameters.Add("@OSPrismDir1", SqlDbType.NVarChar).Value = cboOSPrismDir1.SelectedItem.Text; comm.Parameters.Add("@OSPrism2", SqlDbType.NVarChar).Value = txtOSPrism2.Text; comm.Parameters.Add("@OSPrismDir2", SqlDbType.NVarChar).Value = cboOSPrismDir2.SelectedItem.Text; comm.Parameters.Add("@A", SqlDbType.NVarChar).Value = txtA.Text; comm.Parameters.Add("@B", SqlDbType.NVarChar).Value = txtB.Text; comm.Parameters.Add("@ED", SqlDbType.NVarChar).Value = txtED.Text; comm.Parameters.Add("@DBL", SqlDbType.NVarChar).Value = txtDBL.Text; comm.Parameters.Add("@MountType", SqlDbType.NVarChar).Value = rdoMountType.SelectedItem.Text; comm.Parameters.Add("@Thickness", SqlDbType.NVarChar).Value = rdoThickness.SelectedItem.Text; comm.Parameters.Add("@Tinting", SqlDbType.NVarChar).Value = rdoTinting.SelectedItem.Text; comm.Parameters.Add("@TintColor", SqlDbType.NVarChar).Value = cboTintColor.SelectedItem.Text; comm.Parameters.Add("@Transmission", SqlDbType.NVarChar).Value = cboTransmission.SelectedItem.Text; comm.Parameters.Add("@ARCoating", SqlDbType.NVarChar).Value = rdoARCoating.SelectedItem.Text; comm.Parameters.Add("@UVCoat", SqlDbType.NVarChar).Value = cbUVFilter.Checked; comm.Parameters.Add("@ScratchCoat", SqlDbType.NVarChar).Value = cbScratch.Checked; comm.Parameters.Add("@RollPolish", SqlDbType.NVarChar).Value = cbRollPolish.Checked; comm.Parameters.Add("@RushJob", SqlDbType.NVarChar).Value = cbRush.Checked; comm.Parameters.Add("@SpecialInstructions", SqlDbType.NVarChar).Value = txtSpecialInstructions.Text; comm.Parameters.Add("@Date", SqlDbType.DateTime).Value = DateTime.Now; try { conn.Open(); comm.ExecuteNonQuery(); lblError.Text = "Your order has been placed."; txtLastname.Text = ""; txtFirstname.Text = ""; } catch { lblError.Text = "An Error Occured Processing Your Order. Please Try Again."; } finally { conn.Close(); } } bool filled = false; protected void btnSelectOD_Click(object sender, EventArgs e) { { // Read the connection string from Web.Config // string connectionString = ConfigurationManager.ConnectionStrings["ValueVision"].ConnectionString; // string query = "SELECT LensID, Description FROM ECPLensType1 WHERE ECPLensType1.LensID='" + cboODMaterial.SelectedItem.Value + "'"; // SqlConnection conn = new SqlConnection(connectionString); // SqlCommand comm = new SqlCommand(query, conn); // // Error handling for database code // try // { // conn.Open(); // SqlDataReader reader = comm.ExecuteReader(); // while (reader.Read()) // { // //cboODStyle.DataSource = reader; // cboODStyle.DataValueField = reader.GetValue(0).ToString(); // cboODStyle.DataTextField = reader.GetValue(1).ToString(); // //cboODStyle.DataBind(); // } // //Close the reader // reader.Close(); // } // catch // { // lblError.Text = "* An error occurred retrieving a list of Available Lenses.."; // } // finally // { // //Close the connection // conn.Close(); // } } } protected void btnSelectStyle_Click(object sender, EventArgs e) { string LensType = cboODStyle.SelectedItem.Text; Session["lenstype"] = LensType; lblStyle.Text = LensType; } }bbcompent1
All-Star
33824 Points
8760 Posts
Moderator
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:54 PM|LINK
Not to nitpick mind you but I would suggest putting all that style stuff into a .css file and then reference to it. Drop it into a CSS directory named as mainstyle.css and then do like this:
<link href="~/css/mainstyle.css" rel="stylesheet" type="text/css" />
eyeguy1
Member
2 Points
61 Posts
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 05:57 PM|LINK
It still wants to change the selection to the first item in the second ddl?????????????????
sriramabi
Contributor
4351 Points
1277 Posts
Re: HELP.. Filling Second DropDownList based on parameters of selection in another DropDown List...
May 08, 2012 06:01 PM|LINK
hai
try this
boLensMaterial.DataSource = reader;
cboLensMaterial.DataValueField = "LensID";
cboLensMaterial.DataTextField = "Material";
cboLensMaterial.DataBind();
cboLensMaterial.Items.Insert(0, "select");
cboLensMaterial.Items[0].Value = "0";
thank u