Problema vb.net asp.net

di il
1 risposte

Problema vb.net asp.net

Salve amici

sto progettando un sito web mobile, che deve fare un po di cose.
Dico gia che le pagine sono in asp.net con un pò di javascript e ovviamente CSS e Jquery.

allora ho un paio di problemi che finchè era tutto asp.net senza JS non si verificavano.
Praticamente sia su smartphone che su Pc durante i test ho due problematiche:

Le prime su pc sono:
Firefox visualizza i contenuti correttamente ma non si reindirizza ad una pagina, Internet Explorer invece fa il contrario, va tutto ma non si vede correttamente la pagina.

Su smartphone:
Firefox non vede tutti i contenuti correttamente, il browser web normale di android vede i contenuti ma non si reindirizza ad una pagina.
La pagina in questione per PC e Smartphone è la stessa si chiama elenco_clienti.aspx che viene totalmente ignorata, seppur esiste e da debug viene eseguita.

Vi posto il codice della pagina ricerca che poi deve eseguire elenco_clienti.aspx.

Ricerca.aspx codice
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="ricerca.aspx.vb" Inherits="ricerca" %>

    <!DOCTYPE html>

    <html>
    <head>
        <title>Ricerca Clienti</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    </head>
    <body>

        <form id="form1" runat="server">

    <div data-role="page">
      <div data-role="header">
        <a href="#" class="ui-btn ui-corner-all ui-shadow ui-icon-home ui-btn-icon-left" onclick="return_home()">Home</a>
         
        <h1>Ricerca clienti nel database</h1>
       
      </div>

       <div data-role="main" class="ui-content">
       
            <asp:TextBox ID="ricerca_cli" runat="server" Height="55px" Width="360px" Type="text"></asp:TextBox>

            <br />
            <br />

            <asp:Button ID="Ricerca_cliente" runat="server" Text="Ricerca Cliente"/>
           
     
    </div>
        </div>

        </form>

         <script>
             function return_home() {
                 window.open("home.aspx");
                 window.close("ricerca.aspx");
             }
    </script>

    </body>
    </html>
parte VB
    Imports System.Web.UI

    Partial Class ricerca

        Inherits System.Web.UI.Page

        Protected Sub Ricerca_cliente_Click(sender As Object, e As EventArgs) Handles Ricerca_cliente.Click
            Session("ricerca") = Me.ricerca_cli.Text
            Response.Redirect("~/elenco_clienti.aspx") '
            'Server.Transfer("~/elenco_clienti.aspx")

        End Sub

    End Class
Elenco_clienti.aspx
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="elenco_clienti.aspx.vb" Inherits="elenco_clienti" %>

    <!DOCTYPE html>

    <html>
    <head runat="server">
        <link href="css/elenco_cli.css" rel='stylesheet' type='text/css' />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta name="HandheldFriendly" content="true" />
        <meta name="format-detection" content="telephone=no" />
       <!-- <meta name="viewport" content="width=device-width, user-scalable=0, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />-->
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-title" content="ALPHA Mobile">
        <meta name="viewport" content="width=device-width , user-scalable=yes">
        <meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no" />

        <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
          <!--webfonts-->
          <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text.css'/>
          <!--//webfonts-->

        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
        <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

        <title>Elenco Clienti</title>
    </head>
    <body>
       
        <form id="form1" runat="server">
    <div data-role="page" id="pageone">
      <div data-role="header">
        <h1>Elenco Clienti</h1>
        <div data-role="navbar">
          <ul>
            <li><a href="#" data-icon="home">Home</a></li>
            <li><a href="#" data-icon="arrow-l">Ricerca Clienti</a></li>
            <li><a href="#" data-icon="search">Dettagli</a></li>   
          </ul>
        </div>
      </div>


             <div class ="grid">
                 <asp:GridView ID="GridView1" CssClass="footable" runat="server" AutoGenerateColumns="False"
            Style="max-width: 500px" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical">
                    <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="IDCliente" HeaderText="IDCliente" ReadOnly="true"/>
                    <asp:BoundField DataField ="RagSociale" HeaderText="Ragione Sociale" ReadOnly="true" />
                    <asp:BoundField DataField ="CodFiscale" HeaderText="Codice Fiscale" ReadOnly="true" />
                    <asp:BoundField DataField ="Indirizzo" HeaderText ="Indirizzo" ReadOnly ="true" />
                  <asp:CommandField ShowSelectButton="True" />
                </Columns>
                <FooterStyle BackColor="#CCCC99" />
                <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White"></HeaderStyle>
                <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                <RowStyle BackColor="#F7F7DE" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#FBFBF2" />
                <SortedAscendingHeaderStyle BackColor="#848384" />
                <SortedDescendingCellStyle BackColor="#EAEAD3" />
                <SortedDescendingHeaderStyle BackColor="#575357" />
            </asp:GridView> 

        <link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/css/footable.min.css"
            rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/js/footable.min.js"></script>
        <script type="text/javascript">
            $(function () {
                $('#GridView1').footable();
                breakpoints: {
                        phone: 480;
                        tablet: 1024;
                }
            });
        </script>

                 </div>
        </div>

         


            </form>


         
     


    </body>
    </html>

parte VB
    Imports System.Web.UI
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Collections


    Partial Class elenco_clienti
        Inherits System.Web.UI.Page


        Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            If Not IsPostBack Then
                Me.BindData()
            End If

        End Sub

        Private Sub BindData()
            Dim dt As DataTable = New DataTable()
            dt.Columns.AddRange(New DataColumn(3) {New DataColumn("IDCliente"), New DataColumn("RagSociale"), New DataColumn("CodFiscale"), New DataColumn("Indirizzo")})
            Dim strConnString As String = ConfigurationManager.ConnectionStrings("AlphaMobileS2000ConnectionString").ConnectionString
            Using con As SqlConnection = New SqlConnection(strConnString)
                Dim strQuery As String = "SELECT IDCliente,RagSociale, CodFiscale, Indirizzo FROM dbo.S2000T_Clienti "
                strQuery = strQuery & "WHERE RagSociale LIKE  '" & Session("ricerca") & "%' "
                strQuery = strQuery & "order by RagSociale ASC"

                Using cmd As SqlCommand = New SqlCommand(strQuery)
                    Dim sda As SqlDataAdapter = New SqlDataAdapter
                    cmd.Connection = con
                    con.Open()
                    sda.SelectCommand = cmd
                    sda.Fill(dt)
                    GridView1.DataSource = dt
                    GridView1.DataBind()



                    'Attribute to show the Plus Minus Button.
                    GridView1.HeaderRow.Cells(0).Attributes("data-class") = "expand"

                    'Attribute to hide column in Phone.
                    GridView1.HeaderRow.Cells(2).Attributes("data-hide") = "phone, tablet"
                    GridView1.HeaderRow.Cells(3).Attributes("data-hide") = "phone, tablet"

                    'Adds THEAD and TBODY to GridView.
                    GridView1.HeaderRow.TableSection = TableRowSection.TableHeader

                End Using
            End Using
        End Sub

        Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged
            Dim row As GridViewRow
            row = GridView1.SelectedRow
            Dim ID As String = row.Cells(0).Text
            Session("IDCliente") = ID
            Response.Redirect("~/dettaglio_cliente.aspx")

        End Sub


    End Class

spero riuscite a darmi una mano

1 Risposte

  • Re: Problema vb.net asp.net

    P.s utilizzo una footable per sistemare una gridview per cellulari...

    con internet explorer mi salta fuori questo errore:
    0x800a1391 - Errore di run-time di JavaScript: '__doPostBack' non è definito
Devi accedere o registrarti per scrivere nel forum
1 risposte