Hazel Mahmud

Hazel Mahmud

  • 1.4k
  • 315
  • 70.7k

clear filter expression

Nov 13 2016 4:02 AM
i have below html. how do i clear the filterexpression when the textbox is empty..please help someone...TQ
 
 
<%@ Page Title="" Language="C#" MasterPageFile="~/SiteGeneral.Master" AutoEventWireup="true" CodeBehind="TestAdmin_View.aspx.cs" Inherits="ecevas.Main.TestAdmin_View" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="Scripts/jquery-1.7.2.js"></script>
<script type="text/javascript" src="Scripts/jquery.min.js"></script>
<style type="text/css">


.autocomplete_completionListElement
{
margin: 0px !important;
background-color: white;
color: windowtext;
border: buttonshadow;
border-width: 1px;
border-style: solid;
cursor: 'default';
overflow: auto;
height: 200px;
text-align: left;
list-style-type: none;
padding-left: 1px;
}

/* AutoComplete highlighted item */
.autocomplete_highlightedListItem
{
background-color: #b1e69f;
color: #367c38;
padding: 1px;
cursor: hand;
}
/* AutoComplete item */
.autocomplete_listItem
{
background-color: window;
color: windowtext;
padding: 1px;
}

</style>
<script type="text/javascript">


function clearTextBox(textBoxID) {
document.getElementById("<%=txtNopkj.ClientID %>").value = "";
document.getElementById('<%= GridView1.ClientID %>').style.display = 'block';

}


</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<asp:TextBox ID="txtNopkj" runat="server" AutoPostBack="true" onclick="clearTextBox();" ></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" DelimiterCharacters="" Enabled="True"
ServiceMethod="SearchNopkj" TargetControlID="txtNopkj"
MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000"
CompletionListCssClass="autocomplete_completionListElement"
CompletionListItemCssClass="autocomplete_listItem"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" >
</ajaxToolkit:AutoCompleteExtender>

<%-- <asp:TextBox ID="txtags_name" runat="server" AutoPostBack="true" onclick="clearTextBox();" Width="494px" ></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="txtags_name_AutoCompleteExtender" runat="server"
DelimiterCharacters="" Enabled="True" ServiceMethod="SearchAgency" TargetControlID="txtags_name"
MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000"
CompletionListCssClass="autocomplete_completionListElement"
CompletionListItemCssClass="autocomplete_listItem"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" >
</ajaxToolkit:AutoCompleteExtender> --%>

<br />
<br />

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
AllowPaging="True" PageSize="5">
<Columns>
<asp:TemplateField HeaderText="BIL" ItemStyle-HorizontalAlign="Center" >
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="sl_ss_id" HeaderText="sl_ss_id" SortExpression="sl_ss_id" />
<asp:BoundField DataField="sl_term_id" HeaderText="sl_term_id" SortExpression="sl_term_id" />
<asp:BoundField DataField="sl_cou_id" HeaderText="sl_cou_id" SortExpression="sl_cou_id" />
<asp:BoundField DataField="sl_group_id" HeaderText="sl_group_id" SortExpression="sl_group_id" />
<asp:BoundField DataField="sl_fr_id" HeaderText="sl_fr_id" SortExpression="sl_fr_id" />
<asp:BoundField DataField="sl_lect_id" HeaderText="LECTURERID" ReadOnly="True" SortExpression="sl_lect_id" />
<asp:BoundField DataField="sl_rep_id" HeaderText="sl_rep_id" SortExpression="sl_rep_id" />
<asp:BoundField DataField="sl_cou_bm" HeaderText="sl_cou_bm" SortExpression="sl_cou_bm" />
<asp:BoundField DataField="sl_cou_bi" HeaderText="sl_cou_bi" SortExpression="sl_cou_bi" />
<asp:BoundField DataField="sl_enrolled" HeaderText="sl_enrolled" SortExpression="sl_enrolled" />
<asp:BoundField DataField="sl_evaluated" HeaderText="sl_evaluated" SortExpression="sl_evaluated" />
<asp:BoundField DataField="sl_total" HeaderText="sl_total" SortExpression="sl_total" />
<asp:BoundField DataField="sl_percentage" HeaderText="sl_percentage" SortExpression="sl_percentage" />
<asp:BoundField DataField="sl_datecreate" HeaderText="sl_datecreate" SortExpression="sl_datecreate" />
<asp:TemplateField HeaderText="Action" Visible="True" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<%-- kena tambah session id rep_id untuk tentuka report form 20 jan 2014 --%>
<ItemTemplate>
<%--<asp:LinkButton ID="lbtnReport" runat="server" CommandArgument='<%#Eval("sl_ss_id") + "," +Eval("sl_term_id") + "," +Eval("sl_cou_id") + "," +Eval("sl_group_id") %>' OnClick="lbtnReport_Click" Enabled="false" Visible="false">--%>
<asp:LinkButton ID="lbtnReport" runat="server" CommandArgument='<%#Eval("sl_ss_id") + "," +Eval("sl_term_id") + "," +Eval("sl_cou_id") + "," +Eval("sl_group_id") %>' Enabled="false" Visible="false">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/action_edit.png" ToolTip="Report List" /></asp:LinkButton>
<%--<asp:LinkButton ID="lbtnComment" runat="server" CommandArgument='<%#Eval("sl_term_id") + "," +Eval("sl_cou_id") + "," +Eval("sl_group_id") %>' OnClick="lbtnComment_Click1" Enabled="False" Visible="False">--%><asp:LinkButton ID="lbtnComment" runat="server" CommandArgument='<%#Eval("sl_term_id") + "," +Eval("sl_cou_id") + "," +Eval("sl_group_id") %>' Enabled="False" Visible="False">
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/comment.png" ToolTip="CommentList" /></asp:LinkButton>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

<ItemStyle Wrap="False" />
</asp:TemplateField>
</Columns>
<PagerSettings Mode="NumericFirstLast" />
<PagerStyle CssClass="pgr"></PagerStyle>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ecevasConnectionString1 %>"
SelectCommand="SELECT [sl_ss_id], [sl_term_id], [sl_cou_id], [sl_group_id], [sl_fr_id], [sl_lect_id], [sl_rep_id], [sl_cou_bm], [sl_cou_bi], [sl_enrolled], [sl_evaluated], [sl_total], [sl_percentage], [sl_datecreate] FROM [score_lecturer] WHERE ([sl_term_id] = @sl_term_id)"
FilterExpression="Convert(sl_lect_id, 'System.String') LIKE '%{0}%'">
<SelectParameters>
<asp:FormParameter DefaultValue="A151" FormField="sl_term_id" Name="sl_term_id" Type="String" />
</SelectParameters>
<FilterParameters>
<asp:ControlParameter. Name="LECTURERID" ControlID="txtNopkj" PropertyName="Text" DefaultValue="%"/> .
</FilterParameters>
</asp:SqlDataSource>

</asp:Content>

 

Answers (3)