DropDownList and SQL Server 2008 R2

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 11367 Views - Last Post: 06 May 2011 - 02:52 PM Rate Topic: -----

#1 hacksys  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 27-December 08

DropDownList and SQL Server 2008 R2

Posted 29 April 2011 - 02:39 AM

Hey everyone im having some issues with dropdown list's and sqlserver,

This is an asp.net site that is a work in progress, so heres the deal. I have a dropdown list of state abbreviations which is pulled from sql server. This is populated fine, I also have a DDL with cities in that state that is based on the currently selected state abbreviation. My issue's lie in the following, When the First DDL Box Containing the State Abbreviations; Selected item is changed the cities in the 2nd DDL do not update. Im not sure where, or how the trigger event is raised but here is my code. Note the sql queries work fine, tried and tested. also tried turning on autopostback for DDL1 and had same result of page not updating properly.

For clarification the First DDL is populated with states, Second DDL is populated with cities in the state selected in DDL1, but if DDL1 is changed DDL2 does not update.

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="xxxxxxx.aspx.vb" Inherits="xxxxxx_xxxx.Profile" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 15%;
        }
        .style2
        {
            width: 70%;
        }
        .style3
        {
            width: 15%;
        }
        .style4
        {
            width: 5%;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table>
        <tr>
            <td class="style3"></td>
            <td class="style2">
                <asp:Wizard ID="Wizard1" runat="server" BackColor="#EFF3FB" 
                    BorderColor="#B5C7DE" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" 
                    Width="575px">
                    <HeaderStyle BackColor="#284E98" BorderColor="#EFF3FB" BorderStyle="Solid" 
                        BorderWidth="2px" Font-Bold="True" Font-Size="0.9em" ForeColor="White" 
                        HorizontalAlign="Center" />
                    <NavigationButtonStyle BackColor="White" BorderColor="#507CD1" 
                        BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" 
                        ForeColor="#284E98" />
                    <SideBarButtonStyle BackColor="#465767" BorderColor="White" 
                        Font-Names="Verdana" ForeColor="White" />
                    <SideBarStyle BackColor="#465767" Font-Size="0.9em" HorizontalAlign="Left" 
                        VerticalAlign="Top" Width="110px" />
                    <StartNavigationTemplate>
                        <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" 
                            Text="Next" />
                    </StartNavigationTemplate>
                    <StepStyle Font-Size="0.8em" ForeColor="#333333" />
                    <WizardSteps>
                        <asp:WizardStep runat="server" StepType="Start" title="Basic Information">
                           <table>
                            <tr>
                                <td width="45%" align="right">
                                    <asp:Label ID="Label1" runat="server" Font-Size="Medium" Text="First Name:" 
                                        style="text-align: right"></asp:Label>
                                </td>
                                <td class="style4"></td>
                                <td width="45%">
                                    <asp:TextBox ID="TextBox1" runat="server" Width="218px"></asp:TextBox>
                                </td>
                            </tr>
                             <tr>
                                <td width="45%" align="right">
                                    <asp:Label ID="Label2" runat="server" Font-Size="Medium" Text="Last Name:" 
                                        style="text-align: right"></asp:Label>
                                </td>
                                <td class="style4"></td>
                                <td width="45%">
                                    <asp:TextBox ID="TextBox2" runat="server" Width="218px"></asp:TextBox>
                                </td>
                            </tr>
                             <tr>
                                <td width="45%" align="right"><asp:Label ID="Label5" runat="server" Font-Size="Medium" Text="I Am:" style="text-align: right"></asp:Label></td>
                                <td class="style4"></td>
                                <td>
                                    <asp:DropDownList ID="Sex" runat="server">
                                        <asp:ListItem>Male</asp:ListItem>
                                        <asp:ListItem>Female</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td width="45%" align="right">
                                    <asp:Label ID="Label3" runat="server" Font-Size="Medium" Text="State:" 
                                        style="text-align: right"></asp:Label>
                                </td>
                                <td class="style4"></td>
                                <td width="45%">
                                   <asp:DropDownList ID="DropDownList1" runat="server" 
                                        DataSourceID="SqlDataSource1" DataTextField="Abr" DataValueField="Abr" 
                                        AutoPostBack="True">
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:StateListCS %>" 
                                        SelectCommand="SELECT [Abr] FROM [State_List]"></asp:SqlDataSource>
                                    
                                    <asp:Label ID="Label6" runat="server" Text="Current Selection:"></asp:Label>
                                    <asp:Label ID="Label7" runat="server" Text=""></asp:Label>
                                    <br />
                                    
                                </td>
                            </tr>
                              <tr>
                                <td width="45%" align="right">
                                    <asp:Label ID="Label4" runat="server" Font-Size="Medium" Text="Current City:" 
                                        style="text-align: right"></asp:Label>
                                </td>
                                <td class="style4"></td>
                                <td width="45%">
                                    <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="CityList" 
                                        DataTextField="City" DataValueField="City">
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="CityList" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:CityListCS %>" 
                                        SelectCommand="SELECT [City] FROM [Cities_List] WHERE ([State] = @State)">
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="DropDownList1" Name="State" 
                                                PropertyName="SelectedValue" Type="String" />
                                        </SelectParameters>
                                    </asp:SqlDataSource>
                                    &nbsp;</td>
                            </tr>
                             
                           
                           
                            
                           </table>
                            
                        </asp:WizardStep>
                        <asp:WizardStep runat="server" StepType="Step" title="xxxxxxx">
                        </asp:WizardStep>
                        <asp:WizardStep runat="server" StepType="Finish" Title="xxxxxx">
                        </asp:WizardStep>
                        <asp:WizardStep runat="server" StepType="Complete" Title="xxxxx">
                        </asp:WizardStep>
                    </WizardSteps>
                </asp:Wizard>
            </td>
            <td class="style1"></td>
        </tr>
    </table>
</asp:Content>


Any help is appreciated,
Thanks
hacksys

Is This A Good Question/Topic? 0
  • +

Replies To: DropDownList and SQL Server 2008 R2

#2 marinus  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 138
  • View blog
  • Posts: 575
  • Joined: 14-April 10

Re: DropDownList and SQL Server 2008 R2

Posted 29 April 2011 - 04:07 AM

This sounds like a Job for Javascript , because using the onselectionchaged event in C# only work's when setting DropDown.AutoPostBack = true; for drop-down and this produces nasty postback's , which will have an unnatural feeling for you website form .


Using the onchange event in Javascript for dropdownlist is a better option to do.

You can also take a look at ajax cascading drop-down

http://www.asp.net/a...ngDropDown.aspx


Please lets us know if you need more

Greetings

Marinus
Was This Post Helpful? 1
  • +
  • -

#3 hacksys  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 27-December 08

Re: DropDownList and SQL Server 2008 R2

Posted 29 April 2011 - 11:10 AM

thanks for the direction on this but i think ill go with the javascript instead of re-working the whole site into ajax platform (even though it might be an option depending on the usage) later down the road. Do you have an example of the javascript onchange event coding so i may see the structuring.

Thanks
hacksys

This post has been edited by hacksys: 29 April 2011 - 11:11 AM

Was This Post Helpful? 0
  • +
  • -

#4 marinus  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 138
  • View blog
  • Posts: 575
  • Joined: 14-April 10

Re: DropDownList and SQL Server 2008 R2

Posted 29 April 2011 - 12:20 PM

Good choice to go for Javascript ,
there is lots of examples there in the web ,

i will give you one now

  <script type="text/javascript">

        function ChangeOtherBox(ddl) {

            var selText = ddl.options[ddl.selectedIndex].textContent;
            var ddl2 = document.getElementById("DropDownList2");

           

            switch (selText) {

               
                case 'Guateng':

                    ddl2.selectedIndex = 0;
                    break;

                case 'Jersey':
                    ddl2.selectedIndex = 1;
                    break;


           
            }

        }
    
    </script>
        <p>
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            <asp:DropDownList ID="DropDownList1"  onchange="ChangeOtherBox(this)" runat="server">
                <asp:ListItem>Guateng</asp:ListItem>
                <asp:ListItem>Jersey</asp:ListItem>
                <asp:ListItem>lklkl</asp:ListItem>
                <asp:ListItem>lkl</asp:ListItem>
                <asp:ListItem>klkl</asp:ListItem>
            </asp:DropDownList>
            <asp:DropDownList ID="DropDownList2" runat="server">
                <asp:ListItem>Johannesburg</asp:ListItem>
                <asp:ListItem Value="h">New York</asp:ListItem>
                <asp:ListItem Value="hh">huhh</asp:ListItem>
            </asp:DropDownList>



Study this code a bit , and then you will understand what happens

Good Luck ,

Marinus

EDIT : This code is only tested in FF4

This post has been edited by marinus: 29 April 2011 - 12:47 PM

Was This Post Helpful? 0
  • +
  • -

#5 hacksys  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 27-December 08

Re: DropDownList and SQL Server 2008 R2

Posted 30 April 2011 - 05:55 AM

Marinus thanks for the help so far i've got the code implemented and made a few changes. It works to a point but would make my life a lot easier than making 50 case breaks for each state. heres what i have but im sure there is a syntax error in the js function where the sql queries where options is, how do i use selText var as the text i want to select like the following code implies (doesnt work) but implies. I receive the error that the runat="server" tage is not well formed.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test.aspx.vb" Inherits="Social_Life.Test" %>

<!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 runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    


<script type="text/javascript">

    function ChangeOtherBox(ddl) {

        var selText = ddl.options[ddl.selectedIndex].textContent;
        var ddl2 = document.getElementById("DropDownList2");



        switch (selText) {


           

                 <asp:SqlDataSource ID="CityList" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:CityListCS %>" 
                                        SelectCommand="SELECT [City] FROM [Cities_List] WHERE ([State] = '" & selText & "')">
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="DropDownList1" Name="State" 
                                                PropertyName="SelectedValue" Type="String" />
                                        </SelectParameters>
                                    </asp:SqlDataSource>
               
        }

    }
  
  </script>
      <p>
<asp:DropDownList ID="DropDownList1" DataSourceID="SqlDataSource1" DataTextField="Abr" DataValueField="Abr" onchange="ChangeOtherBox(this)" runat="server">
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:StateListCS %>" 
                                        SelectCommand="SELECT [Abr] FROM [State_List]"></asp:SqlDataSource>
                                    
                             
             
          <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="CityList" 
                                        DataTextField="City" DataValueField="City">
                                    </asp:DropDownList>
                                   
    </div>
    </form>
</body>
</html>


Was This Post Helpful? 0
  • +
  • -

#6 marinus  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 138
  • View blog
  • Posts: 575
  • Joined: 14-April 10

Re: DropDownList and SQL Server 2008 R2

Posted 30 April 2011 - 09:57 AM

Hold on , you can't put asp.net markup code in Javascript , Javascript is programming language ..
it has its own set of rules , keywords and functions , you cant just put asp.net in there , that would never work.

THere is another way .

the best way to do this is simple database management.

e.g

do this to match a value in dropdown 1 to dropdownlist 2

Attached Image

and to show you the code


var ddl2 = document.getElementById("DropDownList2").getElementsByTagName("option");
var ddl1val = document.getElementById("DropDownList1");

var val = ddl1val.options[ddlval.selectedIndex].value;

for(var i = 0 ; ddl2.length; i++)
{
if(ddl[i].value == val)
   ddl2.selectedIndex = i;

}




Also its rather hard to explain this concept to someone new , so to keep it simple


Database Tables

Country<---- Code ---->City code that links these 2 tables



It is clear to me you need to learn Javascript ...

So i would recommend doing that


Greetings

Marinus

This post has been edited by marinus: 30 April 2011 - 10:03 AM

Was This Post Helpful? 0
  • +
  • -

#7 hacksys  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 27-December 08

Re: DropDownList and SQL Server 2008 R2

Posted 30 April 2011 - 04:26 PM

Alright marnius, thanks for the guidence

let me give you an overview of the database structure, I have 2 tables,
State List and City List

State List Structure
[ID] int, [ABR] varchar(2), [State] varchar(Max)

City List Structure
[ID] int, [State ABR] varchar(2), [City] varchar(MAX)

State List is pulled first obviously, and the City List secondly,

SQL for DDL 1 is a simple select * from state_list
which populates DDL1's item list
SQL for DDL2 is also simple (Select * from City_List Where (State = @state)
This works to a point upon first loading of the page, it populates the first selected item from DDL
but upon changing the DDL option it doesnt re-trigger the sql statement to update the DDL2.items

How can i go about triggering the second SQL Statement and Setting the value of @state to DDL1.SelectedItem.Tostring

Is is better to do this in the vb coding on the backside of the page or directly asp.net page coding using js
Was This Post Helpful? 0
  • +
  • -

#8 marinus  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 138
  • View blog
  • Posts: 575
  • Joined: 14-April 10

Re: DropDownList and SQL Server 2008 R2

Posted 01 May 2011 - 02:26 AM

Better to fill the dropdowns with a serverside language (C#,VB.net) . An then do the dropdown selections with Javascript

This post has been edited by marinus: 01 May 2011 - 02:28 AM

Was This Post Helpful? 0
  • +
  • -

#9 SurfingShark  Icon User is offline

  • D.I.C Head

Reputation: 38
  • View blog
  • Posts: 188
  • Joined: 18-April 11

Re: DropDownList and SQL Server 2008 R2

Posted 03 May 2011 - 05:39 PM

Don't be put off by a postback on the server. There are many ways to make this fast and efficient, to the point that the end user doesn't even know there's a postback. Look into AJAX partial postbacks. Just put the DDL into an UpdatePanel, and a few more surrounding elements and it'll hardly seem like a server-side update.
Was This Post Helpful? 1
  • +
  • -

#10 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: DropDownList and SQL Server 2008 R2

Posted 05 May 2011 - 12:23 AM

View Posthacksys, on 30 April 2011 - 04:26 PM, said:

Alright marnius, thanks for the guidence

let me give you an overview of the database structure, I have 2 tables,
State List and City List

State List Structure
[ID] int, [ABR] varchar(2), [State] varchar(Max)

City List Structure
[ID] int, [State ABR] varchar(2), [City] varchar(MAX)

State List is pulled first obviously, and the City List secondly,

SQL for DDL 1 is a simple select * from state_list
which populates DDL1's item list
SQL for DDL2 is also simple (Select * from City_List Where (State = @state)
This works to a point upon first loading of the page, it populates the first selected item from DDL
but upon changing the DDL option it doesnt re-trigger the sql statement to update the DDL2.items

How can i go about triggering the second SQL Statement and Setting the value of @state to DDL1.SelectedItem.Tostring

Is is better to do this in the vb coding on the backside of the page or directly asp.net page coding using js



Javascript isn't going to do you much good in this scenario. You are retrieving a dynamic set of data to bind to your second dropdownlist based on a value that is selected in your first dropdownlist. So regardless, you are going to have to do a postback to requery the database to get an updated dataset. This can be done quite easily with just standard ASP .NET server controls:
<asp:DropDownList ID="DropDownList1" DataSourceID="SqlDataSource1" DataTextField="Abr" DataValueField="Abr" AutoPostBack="true" runat="server">  
</asp:DropDownList>  

<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="CityList" AppendDataBoundItems="true" 
    OnDataBinding="ddl_DataBinding" DataTextField="City" DataValueField="City">  
</asp:DropDownList>  

<asp:SqlDataSource ID="CityList" runat="server" ConnectionString="<%$ ConnectionStrings:CityListCS %>"  
SelectCommand="SELECT [City] FROM [Cities_List] WHERE ([State] = @State)">  
    <SelectParameters> 
        <asp:ControlParameter ControlID="DropDownList1" Name="State" PropertyName="SelectedValue" Type="String" />
    </SelectParameters>  
</asp:SqlDataSource>  

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:StateListCS %>"  
    SelectCommand="SELECT [Abr] FROM [State_List]">
</asp:SqlDataSource>  


Notice how I added the AutoPostBack="true" attribute to the DropDownList1 control. This will cause a server postback to occur automatically each time a different list item is selected from your list of states. In your second dropdownlist I added the AppendDataBoundItems="true" attribute which will append each data item to your list as they are being bound. I also added an event handler for the OnDataBinding event of dropdownlist2.

ddl_DataBinding event in your CodeBehind (.cs/.vb):
protected void ddl_DataBinding(object sender, EventArgs e)
{
    DropDownList ddl = sender as DropDownList;
    if (ddl == null) return;
    
    ddl.Items.Clear();
}


This event handler clears the current list of cities right before the new list of cities gets bound to the dropdownlist control. This will keep the new list from being appended to the old one.

Finally, if you look at the Select statement for your City list datasource I have parameterized the query with the @State parameter and assigned the value for that parameter to the SelectedValue property of the dropdownlist for the states.

HTH
Was This Post Helpful? 1
  • +
  • -

#11 marinus  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 138
  • View blog
  • Posts: 575
  • Joined: 14-April 10

Re: DropDownList and SQL Server 2008 R2

Posted 05 May 2011 - 01:26 AM

I would fill up all the dropdowns , with state and city.

If you then select state on dropdown1 , then you only show the cities that corresponded to the dropdown1 value..

This does not need a postback , and will give you a far better feel. < Which can easily be done with Javascript..

That is just what i would do ;)


Cheers

This post has been edited by marinus: 05 May 2011 - 01:27 AM

Was This Post Helpful? 0
  • +
  • -

#12 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 448
  • View blog
  • Posts: 1,504
  • Joined: 28-April 09

Re: DropDownList and SQL Server 2008 R2

Posted 05 May 2011 - 04:48 AM

why would you want to pre load the drop down with every possible city for every state in the first drop down and then have to filter that with javascript when you could just fetch the data you need when you need it instead?

You're overcomplicating something that is really very simple.

Create the dropdownlists as keakTheGEEK suggests and put them inside an updatepanel and you won't even notice the postback. Only change I might make would be to leave the AppendDataBoundItems as false and then you shouldn't have to clear the city drop down on the server side, it should automatically overwrite the existing items. The AppendDataBoundItems property tells the server to add the new items after the existing items which you do not want to do in this case.

This post has been edited by Nakor: 05 May 2011 - 04:56 AM

Was This Post Helpful? 1
  • +
  • -

#13 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: DropDownList and SQL Server 2008 R2

Posted 05 May 2011 - 09:09 AM

View Postmarinus, on 05 May 2011 - 01:26 AM, said:

I would fill up all the dropdowns , with state and city.

If you then select state on dropdown1 , then you only show the cities that corresponded to the dropdown1 value..

This does not need a postback , and will give you a far better feel. < Which can easily be done with Javascript..

That is just what i would do ;)


Cheers



This sounds like it would work and allow you to not have to do the post back (which sounds like you are trying to avoid). However, this isn't a very practical or common solution to this problem (which is a common one also). Using the AJAX Update Panel to disguise the postback as @SurfingShark and @Nakor suggested is a much more common solution to this problem.

I am not denying the fact that Javascript is a very cool scripting language and it does have its place. But keep in mind that the coolness of Javascript comes at a cost. If a user were to hit your page with Javascript disabled, then the solution you have suggested wouldn't work anymore. They would have no choice but to have to scroll through every city that you have stored in your database no matter what state they selected in the other dropdownlist...
Was This Post Helpful? 0
  • +
  • -

#14 marinus  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 138
  • View blog
  • Posts: 575
  • Joined: 14-April 10

Re: DropDownList and SQL Server 2008 R2

Posted 05 May 2011 - 11:12 AM

Quote

why would you want to pre load the drop down with every possible city for every state in the first drop down and then have to filter that with javascript when you could just fetch the data you need when you need it instead.


Not all off it in Dropdown1 .

The states in dropdown1 and the cities in dropdown2 connected with a value code.

then a simple javascript loop to get all that cities with that same code as the selected state code

Not complicated at all..

But as you said the ajax updatepanel can do the job for you ...

Quote

But keep in mind that the coolness of Javascript comes at a cost. If a user were to hit your page with Javascript disabled, then the solution you have suggested wouldn't work anymore.


That will Probably be a hacker or someone who does not deserve an internet browser. :)

This post has been edited by marinus: 05 May 2011 - 11:16 AM

Was This Post Helpful? 0
  • +
  • -

#15 BrairMoss  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 15
  • View blog
  • Posts: 81
  • Joined: 13-April 10

Re: DropDownList and SQL Server 2008 R2

Posted 05 May 2011 - 02:28 PM

View Postmarinus, on 05 May 2011 - 11:12 AM, said:

Quote

why would you want to pre load the drop down with every possible city for every state in the first drop down and then have to filter that with javascript when you could just fetch the data you need when you need it instead.


Not all off it in Dropdown1 .

The states in dropdown1 and the cities in dropdown2 connected with a value code.

then a simple javascript loop to get all that cities with that same code as the selected state code

Not complicated at all..

But as you said the ajax updatepanel can do the job for you ...

Quote

But keep in mind that the coolness of Javascript comes at a cost. If a user were to hit your page with Javascript disabled, then the solution you have suggested wouldn't work anymore.


That will Probably be a hacker or someone who does not deserve an internet browser. :)



Actually loading all the data into a DropDownList and filtering can be fast if the user needs to switch a lot during one run time. But if the user needs to refresh the page multiple times, loading ALL data everytime gets costly.

The best way is post backs and select data only.

Besides, I have Javascript turned off on everyone web browser in my house simply because it allows me to avoid the annoying popups and abuse that some sites use.

I do disagree with Nakor's turning off the AppendDataBoundItems, but that is a personal preference. I like to use a "Please Select a City..." item as the first item for City Drop Downs so that the user knows what it is they are after. This needs to databounditems enabled. Besides the one line of code should not, key word: should not, cause any delay.

//BrairMoss
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2