AppendDataBoundItems = QUOT;真"属性重复下拉列表值 [英] AppendDataBoundItems="true" property repeated the dropdown list values
本文介绍了AppendDataBoundItems = QUOT;真"属性重复下拉列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i使用下拉列表过滤gridview。所以我必须使用Append数据绑定项true.so下拉列表重复该值并且还取以前的值
....
i只想绑定当前值...
我的代码是.. ..--
i am using drop down list for filtering the gridview .so i have to using Append data bound items true.so drop down list repeated the value and also take the previous value
....
i want to bind only current values...
my code is....--
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master" CodeFile="ShowOverTime.aspx.cs" Inherits="ShowOverTime" %>
<%@ Register TagPrefix="custom" Namespace="myControls" %>
<asp:Content ID="Content1" runat="server"
contentplaceholderid="ContentPlaceHolder1">
ShowOver
<script type="text/javascript">
function basicPopup()
{
popupWindow = window.open("edit.aspx", 'popUpWindow', 'top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No');
}
function basicPopup1()
{
popupWindow = window.open("edit1.aspx", 'popUpWindow', 'top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No');
}
</script>
<table align="center">
<tr>
<td colspan="49" align="center">
<span class="style14">SITE SALARY OF DRIVERS AND
HELPERS</span></td>
</tr>
</table>
<table>
<tr>
<td>
Emp Status</td>
<td class="style13">
Party Name</td>
<td class="style24">
Site Name <br />
<br />
</td>
<td class="style24">
Emp Name</td>
<td class="style24">
Truck No</td>
<td class="style24">
Month</td>
<td class="style24">
Year</td>
<td class="style18">
<asp:Button ID="Button1" runat="server" Height="29px" onclick="Button1_Click1"
Text="PRINT" Width="103px" />
</td>
<td class="style13">
</td>
<td class="style13">
<asp:Button ID="Button2" runat="server" Height="29px" onclick="Button2_Click"
Text="EDIT" Width="103px" Visible="False" OnClientClick="basicPopup();return false;"/>
<asp:Button ID="Button3" runat="server" onclick="Button3_Click"
Text="EDIT" Visible="False" OnClientClick="basicPopup1();return false;" />
</td>
<td class="style13">
</td>
<td class="style13">
<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">Hide
OverTime
<asp:LinkButton ID="LinkButton3" runat="server" onclick="LinkButton3_Click"
Visible="False">Show Overtime
</td>
</tr>
<tr>
<td>
<asp:DropDownList ID="DropDownList6" runat="server" AutoPostBack="True"
Height="32px" Width="107px" AppendDataBoundItems="True"
DataSourceID="SqlDataSource9" DataTextField="EMP_STATUS" DataValueField="EMP_STATUS"
>
<asp:ListItem Text="All" Value="%" >
<asp:SqlDataSource ID="SqlDataSource9" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [EMP_STATUS] FROM [site_attends]">
</td>
<td class="style16">
<asp:DropDownList ID="DropDownList1" runat="server"
AutoPostBack="True" Height="32px" Width="108px" AppendDataBoundItems="true"
onselectedindexchanged="DropDownList1_SelectedIndexChanged"
DataSourceID="SqlDataSource2" DataTextField="PARTY_NAME"
DataValueField="PARTY_NAME">
<asp:ListItem Text="All" Value="%" >
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [PARTY_NAME] FROM [site_assign]">
</td>
<td class="style24">
<asp:DropDownList ID="DropDownList2" runat="server" AppendDataBoundItems="true"
AutoPostBack="True" Height="32px" Width="107px"
onselectedindexchanged="DropDownList2_SelectedIndexChanged"
DataSourceID="SqlDataSource3" DataTextField="SITE_NAME"
DataValueField="SITE_NAME">
<asp:ListItem Text="All" Value="%" >
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [SITE_NAME] FROM [site_assign] WHERE ([PARTY_NAME] = @PARTY_NAME)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="PARTY_NAME"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</td>
<td>
<asp:DropDownList ID="DropDownList7" runat="server" AutoPostBack="True" AppendDataBoundItems="true"
Height="32px" Width="107px" DataSourceID="SqlDataSource4"
DataTextField="NAME" DataValueField="NAME"
>
<asp:ListItem Text="All" Value="%" >
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [NAME] FROM [site_attends] WHERE (([EMP_STATUS] = @EMP_STATUS) AND ([SITE_NAME] = @SITE_NAME))">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList6" Name="EMP_STATUS"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList2" Name="SITE_NAME"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</td>
<td class="style24">
<asp:DropDownList ID="DropDownList3" runat="server"
AutoPostBack="True" Height="32px" Width="107px" AppendDataBoundItems="True"
onselectedindexchanged="DropDownList3_SelectedIndexChanged"
DataSourceID="SqlDataSource8" DataTextField="TRUCK_NO"
DataValueField="TRUCK_NO" >
<asp:ListItem Text="All" Value="%" >
<asp:SqlDataSource ID="SqlDataSource8" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [TRUCK_NO] FROM [site_assign] WHERE ([SITE_NAME] = @SITE_NAME)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" Name="SITE_NAME"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</td>
<td class="style24">
<asp:DropDownList ID="DropDownList4" runat="server" AppendDataBoundItems="true"
AutoPostBack="True" DataSourceID="SqlDataSource5" DataTextField="MONTH"
DataValueField="MONTH" Height="32px"
onselectedindexchanged="DropDownList4_SelectedIndexChanged">
<asp:ListItem Text="All" Value="%">
</td>
<td class="style24">
<asp:DropDownList ID="DropDownList5" runat="server" AppendDataBoundItems="true"
AutoPostBack="True" DataSourceID="SqlDataSource6" DataTextField="YEAR"
DataValueField="YEAR" Height="32px"
onselectedindexchanged="DropDownList5_SelectedIndexChanged">
<asp:ListItem Text="All" Value="%">
</td>
<td class="style19" align="center">
<asp:Label ID="Label5" runat="server" Text="Total">
</td>
<td class="style16">
<asp:Label ID="Label2" runat="server">
</td>
<td class="style16">
<asp:Label ID="Label3" runat="server" Text="Label" Visible="False">
</td>
<td class="style16">
<asp:Label ID="Label4" runat="server" Text="Label" Visible="False">
</td>
<td class="style16">
</td>
</tr>
</table>
<asp:Panel ID="Panel1" runat="server"
>
<table>
<tr>
<td class="style12" align="center">
<span class="style23">A.K. BULK CARRIERS</span><br />
<asp:Label ID="Label6" runat="server"
style="font-weight: 700; font-size: x-large">
<asp:Label ID="Label7" runat="server" style="font-size: large">
<asp:Label ID="Label8" runat="server" style="font-size: large">
</td>
</tr>
<tr>
<td class="style12">
<asp:GridView ID="GridView1" runat="server" AllowPaging="false"
AllowSorting="True" AutoGenerateColumns="False" AutoGenerateSelectButton="true"
BackColor="white" BorderColor="Black" BorderStyle="NotSet" BorderWidth="1px"
CellPadding="3" CellSpacing="2" DataKeyNames="SNO"
DataSourceID="SqlDataSource1" OnRowDataBound="GridView1_RowDataBound"
onselectedindexchanged="GridView1_SelectedIndexChanged" ShowFooter="true"
Visible="True" Width="879px">
<rowstyle backcolor="white" forecolor="black" />
<columns>
<asp:TemplateField HeaderText="S.No.">
<itemtemplate>
<asp:Label ID="lblSerial" runat="server">
</itemtemplate>
<asp:BoundField DataField="PARTY_NAME" HeaderText="PARTY_NAME"
SortExpression="PARTY_NAME" />
<asp:BoundField DataField="SITE_NAME" HeaderText="SITE_NAME"
SortExpression="SITE_NAME" />
<asp:BoundField DataField="TRUCK_NO" HeaderText="TM_NO"
SortExpression="TRUCK_NO" />
<asp:BoundField DataField="EMP_STATUS" HeaderText="E_STATUS"
SortExpression="EMP_STATUS" />
<asp:BoundField DataField="NAME" HeaderText="NAME" SortExpression="NAME" />
<asp:BoundField DataField="DATE" HeaderText="DATE" SortExpression="DATE" />
<asp:BoundField DataField="MONTH" HeaderText="MONTH" SortExpression="MONTH" />
<asp:TemplateField HeaderText="YEAR">
<itemtemplate>
<%# Eval("YEAR") %>
</itemtemplate>
<footertemplate>
TOTAL:
</footertemplate>
<asp:TemplateField HeaderText="OT.SHIFT">
<itemtemplate>
<%# Eval("OVER_HOUR", "{0:c}")%>
</itemtemplate>
<footertemplate>
<asp:Label ID="lbls" Runat="server" />
</footertemplate>
<asp:BoundField DataField="OVER_SALARY" HeaderText="OT_SALARY"
SortExpression="OVER_SALARY" />
<asp:TemplateField HeaderText="TOTAL">
<itemtemplate>
<%# Eval("TOTAL", "{0:c}") %>
</itemtemplate>
<footertemplate>
<asp:Label ID="lblt" Runat="server" />
</footertemplate>
<custom:deletebuttonfield confirmtext="Are you sure that you want to delete this record?" xmlns:custom="#unknown" />
</columns>
<footerstyle backcolor="white" font-bold="True" forecolor="Black" />
<pagerstyle backcolor="White" forecolor="Black" horizontalalign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" />
<br />
</td>
</tr>
<tr>
<td class="style17">
<span class="style14">OVERTIME + REGULAR SHIFT </span> <span>
class="style14">SALARY OF DRIVERS AND HELPERS</span></td>
</tr>
<tr>
<td>
<br />
<asp:SqlDataSource ID="SqlDataSource7" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM site_attends where SNO=@SNO "
FilterExpression=" PARTY_NAME like '{0}%' AND SITE_NAME like '{1}%' AND TRUCK_NO like '{2}%' and MONTH like '{3}%' and YEAR like '{4}%' and EMP_STATUS like '{5}%' AND NAME like '{6}%' "
SelectCommand="SELECT DISTINCT [PARTY_NAME], [SITE_NAME],[EMP_STATUS],[NAME], [TRUCK_NO],[MONTH],[YEAR], [NO_DAYS], [NO_NIGHTS], [TOTAL], [OVER_HOUR], [TOTAL_OVRTIME], [ADV], [PENALTY], [PENALTY_CAUSE], [GROSS_TOTAL],[SNO] FROM [site_attends]">
<filterparameters>
<asp:ControlParameter ControlID="DropDownList1" Name="PARTY_NAME"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList2" Name="SITE_NAME"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList3" Name="TRUCK_NO"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList4" Name="MONTH"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList5" Name="YEAR"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList6" Name="EMP_STATUS"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList7" Name="NAME"
PropertyName="SelectedValue" />
</filterparameters>
<asp:GridView ID="GridView2" runat="server" AllowPaging="false"
AllowSorting="True" AutoGenerateColumns="False" AutoGenerateSelectButton="true"
BackColor="white" BorderColor="Black" BorderStyle="NotSet" BorderWidth="1px"
CellPadding="3" CellSpacing="2" DataKeyNames="SNO"
DataSourceID="SqlDataSource7" OnRowDataBound="GridView2_RowDataBound"
onselectedindexchanged="GridView2_SelectedIndexChanged" ShowFooter="true">
<rowstyle backcolor="white" forecolor="Black" />
<columns>
<asp:TemplateField HeaderText="S.No.">
<itemtemplate>
<asp:Label ID="lblSerial" runat="server">
</itemtemplate>
<asp:BoundField DataField="EMP_STATUS" HeaderText="E_STATUS"
SortExpression="EMP_STATUS" />
<asp:BoundField DataField="NAME" HeaderText="NAME" SortExpression="NAME" />
<asp:TemplateField HeaderText="TM_NO">
<itemtemplate>
<%# Eval("TRUCK_NO", "{0:c}")%>
</itemtemplate>
<footertemplate>
TOTAL:
</footertemplate>
<asp:TemplateField HeaderText="DAYS">
<itemtemplate>
<%# Eval("NO_DAYS", "{0:c}")%>
</itemtemplate>
<footertemplate>
<asp:Label ID="lblDAYS" Runat="server" />
</footertemplate>
<asp:TemplateField HeaderText="TOTAL">
<itemtemplate>
<%# Eval("TOTAL", "{0:c}")%>
</itemtemplate>
<footertemplate>
<asp:Label ID="lblTOTAL" Runat="server" />
</footertemplate>
<asp:TemplateField HeaderText="O.T. SHIFT">
<itemtemplate>
<%# Eval("OVER_HOUR", "{0:c}")%>
</itemtemplate>
<footertemplate>
<asp:Label ID="lblOT" Runat="server" />
</footertemplate>
<asp:TemplateField HeaderText="TO.+OT">
<itemtemplate>
<%# Eval("TOTAL_OVRTIME", "{0:c}")%>
</itemtemplate>
<footertemplate>
<asp:Label ID="lblttl" Runat="server" />
</footertemplate>
<asp:TemplateField HeaderText="ADV">
<itemtemplate>
<%# Eval("ADV", "{0:c}")%>
</itemtemplate>
<footertemplate>
<asp:Label ID="lblADV" Runat="server" />
</footertemplate>
<asp:BoundField DataField="PENALTY" HeaderText="PENALTY"
SortExpression="PENALTY" />
<asp:TemplateField HeaderText="GROSS SALARY">
<itemtemplate>
<%# Eval("GROSS_TOTAL", "{0:c}") %>
</itemtemplate>
<footertemplate>
<asp:Label ID="lblSummary" Runat="server" />
</footertemplate>
<custom:deletebuttonfield confirmtext="Are you sure that you want to delete this record?" xmlns:custom="#unknown" />
</columns>
<footerstyle backcolor="white" font-bold="True" forecolor="Black" />
<pagerstyle forecolor="Black" horizontalalign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="delete from overtime where SNO=@SNO"
FilterExpression=" PARTY_NAME like '{0}%' AND SITE_NAME like '{1}%' AND TRUCK_NO like '{2}%' and MONTH like '{3}%' and YEAR like '{4}%' and EMP_STATUS like '{5}%' AND NAME like '{6}%' "
SelectCommand="SELECT DISTINCT PARTY_NAME,SITE_NAME,TRUCK_NO,EMP_STATUS,NAME,DATE,MONTH,YEAR,OVER_HOUR,OVER_SALARY,TOTAL,SNO FROM [overtime]">
<filterparameters>
<asp:ControlParameter ControlID="DropDownList1" Name="PARTY_NAME"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList2" Name="SITE_NAME"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList3" Name="TRUCK_NO"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList4" Name="MONTH"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList5" Name="YEAR"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList6" Name="EMP_STATUS"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="DropDownList7" Name="NAME"
PropertyName="SelectedValue" />
</filterparameters>
<asp:SqlDataSource ID="SqlDataSource5" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [MONTH] FROM [site_attends]">
<asp:SqlDataSource ID="SqlDataSource6" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [YEAR] FROM [site_attends]">
</td>
</tr>
</table>
<asp:Content ID="Content2" runat="server" contentplaceholderid="head">
<style type="text/css">
.style12
{
width: 751px;
}
.style13
{
width: 751px;
font-size: medium;
}
.style14
{
font-size: x-large;
}
.style16
{
font-size: medium;
height: 43px;
}
.style17
{
text-align: center;
}
.style18
{
width: 91px;
font-size: medium;
}
.style19
{
width: 91px;
font-size: medium;
height: 43px;
}
.style23
{
font-size: xx-large;
}
.style24
{
width: 525px;
}
</style>
推荐答案
ConnectionStrings:ConnectionString %>\"
SelectCommand=\"SELECT DISTI NCT [EMP_STATUS] FROM [site_attends]\">
</td>
<td class=\"style16\">
<asp:DropDownList ID=\"DropDownList1\" runat=\"server\"
AutoPostBack=\"True\" Height=\"32px\" Width=\"108px\" AppendDataBoundItems=\"true\"
onselectedindexchanged=\"DropDown List1_SelectedIndexChanged\"
DataSourceID=\"SqlDataSource2\" DataTextField=\"PARTY_NAME\"
DataValueField=\"PARTY_NAME\">
<asp:ListItem Text=\"All\" Value=\"%\" >
<asp:SqlDataSource ID=\"SqlDataSource2\" runat=\"server\"
ConnectionString=\" <%
ConnectionStrings:ConnectionString %>" SelectCommand="SELECT DISTINCT [EMP_STATUS] FROM [site_attends]"> </td> <td class="style16"> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" Height="32px" Width="108px" AppendDataBoundItems="true" onselectedindexchanged="DropDownList1_SelectedIndexChanged" DataSourceID="SqlDataSource2" DataTextField="PARTY_NAME" DataValueField="PARTY_NAME"> <asp:ListItem Text="All" Value="%" > <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%
ConnectionStrings:ConnectionString %>\"
SelectCommand=\"SELECT DISTINCT [PARTY_NAME] FROM [site_assign]\">
</td>
<td class=\"style24\">
<asp:DropDownList ID=\"DropDownList2\" runat=\"server\" AppendDataBoundItems=\"true\"
AutoPostBack=\"True\" Height=\"32px\" Width=\"107px\"
onselectedindexchanged=\"DropDownList2_SelectedIndexChanged\"
DataSourceID=\"SqlDataSource3\" DataTextField=\"SITE_NAME\"
DataValueField=\"SITE_NAME\">
<asp:ListItem Text=\"All\" Value=\"%\" >
& lt;asp:SqlDataSource ID=\"SqlDataSource3\" runat=\"server\"
ConnectionString=\"<%
ConnectionStrings:ConnectionString %>" SelectCommand="SELECT DISTINCT [PARTY_NAME] FROM [site_assign]"> </td> <td class="style24"> <asp:DropDownList ID="DropDownList2" runat="server" AppendDataBoundItems="true" AutoPostBack="True" Height="32px" Width="107px" onselectedindexchanged="DropDownList2_SelectedIndexChanged" DataSourceID="SqlDataSource3" DataTextField="SITE_NAME" DataValueField="SITE_NAME"> <asp:ListItem Text="All" Value="%" > <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%
ConnectionStrings:ConnectionString %>\"
< span class =code-attribute> SelectCommand=\"SELECT DISTINCT [SITE_NAME] FROM [site_assign] WHERE ([PARTY_NAME] = @PARTY_NAME)\">
<SelectParameters>
<asp:ControlParameter ControlID=\"DropDownList1\" Name=\"PARTY_NAME\"
< span class =code-attribute> PropertyName=\"SelectedValue\" Type=\"String\" />
</SelectParameters>
</td>
<td>
<asp:DropDownList ID=\"DropDownList7\" runat=\"server\" AutoPostBack=\"True\" AppendDataBoundItems=\"true\"
Height=\"32px\" Width=\"107px\" DataSourceID=\"SqlDataSource4\" DataTextField=\"NAME\" DataValueField=\"NAME\"
>
< asp:ListItem Text=\"All\" Value=\"%\" >
<asp:SqlDataSource ID=\"SqlDataSource4\" runat=\"server\"
ConnectionString=\"<%
ConnectionStrings:ConnectionString %>" SelectCommand="SELECT DISTINCT [SITE_NAME] FROM [site_assign] WHERE ([PARTY_NAME] = @PARTY_NAME)"> <SelectParameters> <asp:ControlParameter ControlID="DropDownList1" Name="PARTY_NAME" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </td> <td> <asp:DropDownList ID="DropDownList7" runat="server" AutoPostBack="True" AppendDataBoundItems="true" Height="32px" Width="107px" DataSourceID="SqlDataSource4" DataTextField="NAME" DataValueField="NAME" > <asp:ListItem Text="All" Value="%" > <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%
这篇关于AppendDataBoundItems = QUOT;真"属性重复下拉列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文