Loading ...

DataList in Asp Panel with modal Popup

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  web forms / data controls   » DataList in Asp Panel with modal Popup

DataList in Asp Panel with modal Popup

Posts under the topic: DataList in Asp Panel with modal Popup

Posted: 7/14/2011

Lurker 360  points  Lurker
  • Joined on: 6/5/2011
  • Posts: 51

I have a databound dropdown. When a value is changed and the Submit button is clicked, I want the Asp Panel to popup(Which it does) and then the select query to be run and displayed in the datalist in the popup.  

I tried writing an event handler like:

 protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            SqlDataSource1.Select();
        }


I also tried the DataBind method. No luck.

How can I have the datalist display my result from my SELECT query when the submit button is clicked to fire the modal popup?

Here is the code from my page:

   <asp:DropDownList ID="StoreNameDBDD" runat="server" 
                                DataSourceID="StoreListSqlDs" DataTextField="StoreName" 
                                DataValueField="StoreName">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Button ID="SubmitBtn" runat="server" Text="Submit"   
                               />
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                                     </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:SqlDataSource ID="StoreListSqlDs" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:CouponBotConnectionString1 %>" 
                                SelectCommand="SELECT [StoreName] FROM [StoreNames]"></asp:SqlDataSource>

                                <asp:Panel ID="MPopupPanel" BackColor="#9E9B97"   runat="server" Width="800px" Height="800px"  ScrollBars="Auto">
                                    <table align="center" cellpadding="0" cellspacing="1" 
    class="style1">
                                        <tr>
                                            <td align="right">
                                                <asp:ImageButton ID="ClosePu" runat="server" 
                                                    ImageUrl="~/Images/xxxxClose.jpg" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:DataList ID="DataList1" runat="server" CellPadding="4" 
                                                    DataSourceID="SqlDataSource1" ForeColor="#333333" style="margin-bottom: 1px">
                                                    <AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                    <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                    <ItemTemplate>
                                                        Policy:
                                                        <asp:Label ID="PolicyLabel" runat="server" Text='<%# Eval("Policy") %>' />
                                                        <br />
                                                        <br />
                                                    </ItemTemplate>
                                                    <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                </asp:DataList>
                                                <br />
                                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                                    ConnectionString="<%$ ConnectionStrings:CouponBotConnectionString1 %>" 
                                                    SelectCommand="SELECT [Policy] FROM [Policies] WHERE ([StoreName] = @StoreName)">
                                                    <SelectParameters>
                                                        <asp:ControlParameter ControlID="StoreNameDBDD" Name="StoreName" 
                                                            PropertyName="SelectedValue" Type="String" />
                                                    </SelectParameters>
                                                </asp:SqlDataSource>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            <asp:ModalPopupExtender ID="ModalPopupExtender1"   PopupDragHandleControlID="MPopupPanel" Drag="true" DropShadow="true" TargetControlID="SubmitBtn" CancelControlID="ClosePu" PopupControlID="MPopupPanel" runat="server">
                            </asp:ModalPopupExtender>
Thanks in advance!


Page 1 of 1 (1 items)