none
search results from an Imagemap choice RRS feed

  • Question


  • Hi, I'm Italian. sorry for my not perfect English
    I would like to show database results.
    I successfully done it using an asp form containing a dropdown box menu or a text field.

    If I try to do that with an ImageMap , the page doesn't show mw any results.

    The first page is the following:

    -----------------------------------------------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Page Language="C#" %>

    <script runat="server">
    protected void Cartina_Click(object sender, ImageMapEventArgs e)
    {
        String region = "";
        switch(e.PostBackValue)
        {
            case "Puglia":
                region = "Puglia";
                break;
            case "Calabria":
                region = "Calabria";
                break;
            case "Basilicata":
                region = "Basilicata";
                break;

               }
        Label1.Text = "Hai scelto la regione " + region ;
    }
    </script>

    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Ricerca negli annunci</title>
    <style type="text/css">
    .style1 {
    text-align: left;
    }
    </style>
    </head>

    <body>

    <form id="form1" runat="server" style="height: 581px">
    <div class="style1">
    <strong>Ricerca annunci per regione:<br />
    </strong><br />
    <asp:Label id="Label1" runat="server" AssociatedControlID="Cartina"></asp:Label>
    <asp:ImageMap id="Cartina" runat="server" Height="484px" HotSpotMode="PostBack" OnClick="Cartina_Click" ImageUrl="img/italia.gif" style="height: 499px" Width="484px">
    <asp:circlehotspot HotSpotMode="Inactive" />
    <asp:polygonhotspot Coordinates="374, 350, 385, 381, 392, 395, 388, 400, 379, 404, 381, 418, 369, 428, 381, 446, 396, 436, 398, 429, 408, 416, 410, 396, 428, 393, 426, 368, 406, 357, 407, 342, 398, 340, 391, 347, 374, 346, 375, 346" PostBackValue="Calabria" HotSpotMode="PostBack" AlternateText="Calabria" AccessKey=" " />
    <asp:polygonhotspot Coordinates="353, 264, 385, 259, 390, 270, 382, 282, 450, 313, 474, 336, 468, 351, 448, 348, 443, 336, 428, 335, 416, 327, 410, 329, 403, 313, 393, 313, 382, 307, 379, 301, 366, 301, 352, 300, 344, 283" PostBackValue="Puglia" HotSpotMode="PostBack" AlternateText="Puglia" />
    <asp:polygonhotspot AlternateText="Basilicata" Coordinates="364, 306, 367, 298, 380, 298, 388, 306, 398, 315, 405, 312, 410, 323, 407, 340, 399, 340, 396, 349, 384, 350, 376, 350, 366, 347, 372, 335, 360, 310" HotSpotMode="PostBack" PostBackValue="Basilicata" />
    </asp:ImageMap>
    <br />
    <br />
    <asp:Button id="Button1" runat="server" PostBackUrl="risultati.aspx" Text="Cerca" />
    </div>
    </form>

    </body>

    </html>

    -----------------------------------------------------------

    The second page:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Page Language="C#" %>
    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Senza nome 1</title>
    </head>

    <body>

    <form id="form1" runat="server">
    <asp:GridView id="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="AccessDataSource1" GridLines="Horizontal" AllowPaging="True">
    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
    <Columns>
    <asp:boundfield DataField="regione" HeaderText="regione" SortExpression="regione">
    </asp:boundfield>
    <asp:boundfield DataField="categoria" HeaderText="categoria" SortExpression="categoria">
    </asp:boundfield>
    <asp:boundfield DataField="annuncio" HeaderText="annuncio" SortExpression="annuncio">
    </asp:boundfield>
    <asp:boundfield DataField="immagine" HeaderText="immagine" SortExpression="immagine">
    </asp:boundfield>
    </Columns>
    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
    <AlternatingRowStyle BackColor="#F7F7F7" />
    </asp:GridView>
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="fpdb/annunci_db.mdb" SelectCommand="SELECT [regione], [categoria], [annuncio], [immagine] FROM [annunci] WHERE ([regione] = ?)">
    <SelectParameters>
    <asp:formparameter FormField="Cartina" Name="regione" Type="String" />
    </SelectParameters>
    </asp:AccessDataSource>
    </form>

    </body>

    </html>

    ---------------------------------------------
    can Anybody tell me what is wrong?

    Thank you all

    Thursday, May 26, 2016 12:48 PM

All replies