Datagrid control in ASP.Net mobile application

Discussion in 'ASP .Net Mobile' started by TJ, May 3, 2005.

  1. TJ

    TJ Guest

    I want to use the datagrid control in an ASP.Net mobile web application
    ..

    IS it possible to use it in mobile applications???

    When I run the following code, I get a blank webpage.
    I have added the datagrid inside the <Device Specific> tag


    Any suggestions. Thanks


    <% @Import Namespace="System.Data" %>
    <% @Import Namespace="System.Data.SqlClie­nt" %>
    <HEAD>
    <...
    <meta
    content="http://schemas.microsoft.com/M­obile/Page"name="vs_targetSchema">

    </HEAD>
    <body Xmlns:mobile="http://schemas.microsoft.com/M­obile/WebForm">


    <script language="vb" runat="server">
    Sub Page_Load(sender as Object, e as EventArgs)
    If Not Page.IsPostBack then
    BindData() 'Only bind the data on the first page load
    End If
    End Sub


    Sub BindData()
    Const SQL_CONNECTION_STRING As String =
    "Server=WA;DataBase=SOLLI;user­=sa;password=''"
    Dim conConnection As New SqlConnection(SQL_CONNECTION_S­TRING)
    Dim strSQL As String
    strSQL = "xWEBRSM_SelectInvoices"


    Dim cmdReport As New SqlCommand(strSQL, conConnection)
    cmdReport.CommandType = CommandType.StoredProcedure


    Dim prmSiteID As SqlParameter =
    cmdReport.Parameters.Add("@Sit­eID", SqlDbType.Char, 10)
    prmSiteID.Value = "S000766"


    Dim myAdapter As New SqlDataAdapter(cmdReport)
    Dim ds As New DataSet
    myAdapter.Fill(ds)


    conConnection.Close()
    DataGrid1.DataSource=ds
    Datagrid1.DataBind()
    End Sub


    </script>
    <mobile:form id="Form1" runat="server">
    <mobile:ObjectList id="ObjectList1" runat="server"
    LabelStyle-StyleReference="tit­le"
    CommandStyle-StyleReference="s­ubcommand"></mobile:ObjectList­>
    <mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
    <Choice
    Xmlns="http://schemas.microsoft.com/m­obile/html32template">
    <HeaderTemplate>
    <asp:DataGrid id="DataGrid1" runat="server">


    </asp:DataGrid>
    </HeaderTemplate>
    </Choice>
    </mobile:DeviceSpecific>
    </mobile:form>
    </body>
     
    TJ, May 3, 2005
    #1
    1. Advertising

  2. TJ

    Leon Guest

    use objectlist instead
    "TJ" <> ????
    news:...

    I want to use the datagrid control in an ASP.Net mobile web application
    ..

    IS it possible to use it in mobile applications???

    When I run the following code, I get a blank webpage.
    I have added the datagrid inside the <Device Specific> tag


    Any suggestions. Thanks


    <% @Import Namespace="System.Data" %>
    <% @Import Namespace="System.Data.SqlClie­nt" %>
    <HEAD>
    <...
    <meta
    content="http://schemas.microsoft.com/M­obile/Page"name="vs_targetSchema">

    </HEAD>
    <body Xmlns:mobile="http://schemas.microsoft.com/M­obile/WebForm">


    <script language="vb" runat="server">
    Sub Page_Load(sender as Object, e as EventArgs)
    If Not Page.IsPostBack then
    BindData() 'Only bind the data on the first page load
    End If
    End Sub


    Sub BindData()
    Const SQL_CONNECTION_STRING As String =
    "Server=WA;DataBase=SOLLI;user­=sa;password=''"
    Dim conConnection As New SqlConnection(SQL_CONNECTION_S­TRING)
    Dim strSQL As String
    strSQL = "xWEBRSM_SelectInvoices"


    Dim cmdReport As New SqlCommand(strSQL, conConnection)
    cmdReport.CommandType = CommandType.StoredProcedure


    Dim prmSiteID As SqlParameter =
    cmdReport.Parameters.Add("@Sit­eID", SqlDbType.Char, 10)
    prmSiteID.Value = "S000766"


    Dim myAdapter As New SqlDataAdapter(cmdReport)
    Dim ds As New DataSet
    myAdapter.Fill(ds)


    conConnection.Close()
    DataGrid1.DataSource=ds
    Datagrid1.DataBind()
    End Sub


    </script>
    <mobile:form id="Form1" runat="server">
    <mobile:ObjectList id="ObjectList1" runat="server"
    LabelStyle-StyleReference="tit­le"
    CommandStyle-StyleReference="s­ubcommand"></mobile:ObjectList­>
    <mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
    <Choice
    Xmlns="http://schemas.microsoft.com/m­obile/html32template">
    <HeaderTemplate>
    <asp:DataGrid id="DataGrid1" runat="server">


    </asp:DataGrid>
    </HeaderTemplate>
    </Choice>
    </mobile:DeviceSpecific>
    </mobile:form>
    </body>
     
    Leon, Jun 24, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chen selina
    Replies:
    0
    Views:
    1,319
    chen selina
    Jul 13, 2010
  2. TJ

    Datagrid control in asp.net mobile web application

    TJ, May 2, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    166
  3. Ryan Malone
    Replies:
    0
    Views:
    172
    Ryan Malone
    Aug 23, 2004
  4. Yaiz
    Replies:
    0
    Views:
    188
  5. dawson
    Replies:
    0
    Views:
    168
    dawson
    Jul 12, 2005
Loading...

Share This Page