all groups > asp.net mobile > may 2005 >
You're in the

asp.net mobile

group:

Datagrid control in ASP.Net mobile application


Datagrid control in ASP.Net mobile application TJ
5/3/2005 6:40:17 AM
asp.net mobile:

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=3D"System.Data" %>
<% @Import Namespace=3D"System.Data.SqlClie=ADnt" %>
<HEAD>
<=2E..
<meta
content=3D"http://schemas.microsoft.com/M=ADobile/Page"name=3D"vs_targetSch=
ema">

</HEAD>
<body Xmlns:mobile=3D"http://schemas.microsoft.com/M=ADobile/WebForm">


<script language=3D"vb" runat=3D"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 =3D
"Server=3DWA;DataBase=3DSOLLI;user=AD=3Dsa;password=3D''"
Dim conConnection As New SqlConnection(SQL_CONNECTION_S=ADTRING)
Dim strSQL As String
strSQL =3D "xWEBRSM_SelectInvoices"


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


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


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


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


</script>
<mobile:form id=3D"Form1" runat=3D"server">
<mobile:ObjectList id=3D"ObjectList1" runat=3D"server"
LabelStyle-StyleReference=3D"tit=ADle"
CommandStyle-StyleReference=3D"s=ADubcommand"></mobile:ObjectList=AD>
<mobile:DeviceSpecific id=3D"DeviceSpecific1" runat=3D"server">
<Choice
Xmlns=3D"http://schemas.microsoft.com/m=ADobile/html32template">
<HeaderTemplate>
<asp:DataGrid id=3D"DataGrid1" runat=3D"server">


</asp:DataGrid>
</HeaderTemplate>
</Choice>
</mobile:DeviceSpecific>=20
</mobile:form>=20
</body>
Re: Datagrid control in ASP.Net mobile application Leon
6/24/2005 12:00:00 AM
use objectlist instead
"TJ" <flower_t@rediffmail.com> ????
news:1115127616.982287.97430@f14g2000cwb.googlegroups.com...

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>

AddThis Social Bookmark Button