Click here to Skip to main content
11,928,078 members (43,101 online)
Rate this:
Please Sign up or sign in to vote.
See more: .NET .NET4
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">

<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 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" />
                           <asp:BoundField DataField="prodname" HeaderText="Product Name"
                           <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" />
                       <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:SqlDataSource ID="SqlDataSource1" runat="server"
                       ConnectionString="<%$ ConnectionStrings:ABC %>"
                       SelectCommand="SELECT [prodname], [prodcode], [rate], [description] FROM [products] ORDER BY [prodname]"
                       FilterExpression="prodcode LIKE '%{0}%'">
                       controlid="txtprodcode" ConvertEmptyStringToNull="False" />

Posted 11-Jan-13 1:09am
Edited 11-Jan-13 1:39am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

again show that model popup in filter event. then it will show.

try it..

Happy Coding Smile | :)
sarfaraz050 11-Jan-13 7:47am
yup its working now... i tried btnadditem_ModalPopupExtender.Show(); in filter event n its working thnx 4 help.. :)
prashant patil 4987 13-Jan-13 22:16pm
always welcome,,,,......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100