westdh
asked on
asp.net I have just added some code with a skin template. I would like to know how to prevent it from excuting twice.
the dropdownlist gets filled properly when the page is displayed, but it is filled twice (the list is duplicated). How can I prevent from occuring within the code i have added.
<div>
<table align="center" border="0" cellpadding="2">
<tr>
<td width="320">
<asp:DropDownList ID="ddlExt3" DataSourceID="dsPopulateExt3" AutoPostBack="true"
DataValueField="MyData" runat="server" Width="110px" Font-Size="11px" AppendDataBoundItems="true">
<asp:ListItem Text="All" Value="%"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<asp:SqlDataSource ID="dsPopulateExt3" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>"
SelectCommand="SELECT DISTINCT [State] + ' ' + [City] + ' ' + [Ext2] + ' ' + [Ext3] AS MyData
FROM [trip4usdnn].[trip4usdnn].[Netism_MapExtreme_Locations] where state = 'OR' or state = 'WA'"></asp:SqlDataSource>
</div>
remove AutoPostBack="true"
Sorry renove AppendDataBoundItems="true "
remove AppendDataBoundItems="true "
Dim dr As ListItem = New ListItem("", "0")
Dim ss = address.GetStates
With Me.ddlStates
.Items.Clear()
.Items.Add(dr)
.DataSource = ss
.DataBind()
End With
ASKER
How do I merge these two together?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body style="background-color: #8f8fb1">
<form id="form1" runat="server">
<div>
<table align="center" border="0" cellpadding="2">
<tr>
<td width="320">
<asp:DropDownList ID="ddlExt3" DataSourceID="dsPopulateExt3" AutoPostBack="true"
DataValueField="MyData" runat="server" Width="110px" Font-Size="11px" AppendDataBoundItems="true">
<asp:ListItem Text="All" Value="%"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<asp:SqlDataSource ID="dsPopulateExt3" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>"
SelectCommand="SELECT DISTINCT [State] + ' ' + [City] + ' ' + [Ext2] + ' ' + [Ext3] AS MyData
FROM [trip4usdnn].[trip4usdnn].[Netism_MapExtreme_Locations] where state = 'OR' or state = 'WA'"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
Dim dr As ListItem = New ListItem("", "0")
Dim ss = address.GetStates
With Me.ddlStates
.Items.Clear()
.Items.Add(dr)
.DataSource = ss
.DataBind()
End With
Toggle Highlighting
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks you for your support