ModalpopupExtender在gridview中过滤数据时消失。 [英] ModalpopupExtender disappears while filtering data in gridview.
本文介绍了ModalpopupExtender在gridview中过滤数据时消失。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新手,所以请耐心等待。我正在使用模态弹出扩展器来在gridview中显示产品。我用于模态弹出窗口的面板中有一个gridview,我使用文本框来过滤gridview但是每当我在文本框中输入产品代码并点击''enter''时,模态弹出窗口就会消失并显示已过滤当我再次打开它时的数据。
这是代码:
I am a newbie so please bear with me. I am using a modal popup extender to display products in a gridview. The panel that i''ve used for modal popup has a gridview in it and I am using a textbox to filter the gridview but whenever I enter the product code in the textbox and hit ''enter'' modal popup disappears and it shows filtered data when I open it again.
Here is the code:
<asp:Button ID="btnadditem" runat="server" Text="Add Items" />
<cc1:ModalPopupExtender ID="btnadditem_ModalPopupExtender" runat="server"
CancelControlID="btnCancel" DynamicServicePath="" Enabled="True"
OkControlID="btnSave" PopupControlID="Panel2" TargetControlID="btnadditem"
PopupDragHandleControlID="popupdrag" Drag="True">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel2" runat="server" Height="291px" Width="516px"
BorderColor="Black" BorderWidth="2px" BackColor="#EEEEEE">
<div id="popupdrag" style="width: 100%; background-color: #1B548D; height: 31px;"><div align="left" style="float:left;">
<asp:Button ID="btnCancel" runat="server" Text="Cancel" /></div>
<div align="center" style="float:left; width:400px; height: 31px; line-height:30px; color:#fff"><strong>Add Products</strong></div><div align="right" style="float:right;">
<asp:Button ID="btnSave" runat="server" Text="Save" /></div></div>
<div style="width: 100%; line-height:30px; height: 259px;";"><div style="width:50%; float:left;">
</div>
<div style="width:15%; float:left;">
<strong>Product Code</strong></div><div style="width:35%; float:left;">
<asp:TextBox ID="txtprodcode" runat="server" Width="90%" AutoPostBack="True"></asp:TextBox></div>
<asp:GridView ID="GridView1" runat="server" Width="100%" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3"
DataSourceID="SqlDataSource1" PageSize="5">
<RowStyle HorizontalAlign="center" />
<Columns>
<asp:BoundField DataField="prodname" HeaderText="Product Name"
SortExpression="prodname"/>
<asp:BoundField DataField="prodcode" HeaderText="Product Code"
SortExpression="prodcode" />
<asp:BoundField DataField="rate" HeaderText="Rate" SortExpression="rate" />
<asp:BoundField DataField="description" HeaderText="Description"
SortExpression="description" />
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="center" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ABC %>"
SelectCommand="SELECT [prodname], [prodcode], [rate], [description] FROM [products] ORDER BY [prodname]"
FilterExpression="prodcode LIKE '%{0}%'">
<FilterParameters>
<asp:ControlParameter
controlid="txtprodcode" ConvertEmptyStringToNull="False" />
</FilterParameters>
</asp:SqlDataSource>
</div>
</asp:Panel
>
>
推荐答案
ConnectionStrings:ABC %>\"
SelectCommand=\"SELECT [prodname], [prodcode], [rate], [description] FROM [products] ORDER BY [prodname]\"
FilterExpression=\"prodcode LIKE '%{0}%'\">
<FilterParameters>
<asp:ControlParameter
controlid=\"txtprodcode\" ConvertEmptyStringToNull=\"False\" />
</FilterParameters>
</asp:SqlDataSource>
</div>
</asp:Panel
ConnectionStrings:ABC %>" SelectCommand="SELECT [prodname], [prodcode], [rate], [description] FROM [products] ORDER BY [prodname]" FilterExpression="prodcode LIKE '%{0}%'"> <FilterParameters> <asp:ControlParameter controlid="txtprodcode" ConvertEmptyStringToNull="False" /> </FilterParameters> </asp:SqlDataSource> </div> </asp:Panel
>
>
again show that model popup in filter event. then it will show.
try it..
Happy Coding :)
again show that model popup in filter event. then it will show.
try it..
Happy Coding :)
这篇关于ModalpopupExtender在gridview中过滤数据时消失。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文