Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
XML
<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>


XML
<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;">
                   &nbsp;</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

>
Posted
Updated 11-Jan-13 0:39am
v4

1 solution

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

try it..

Happy Coding :)
 
Share this answer
 
Comments
lucky050 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900