[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

pedro castanheira

5/16/2002 3:04:00 PM

I´m developing an application to be used by Mobile Phones.

In one particular page I've a table with two rows and to columns with four
mobile labels inside. I change the values of the labels in runtime and the
table displays ok in my wap device.

Now I'm trying to do a dynamic table that can have x rows and always 3
columns per row.
I've tried it several ways:

1- A device specific for WML1.1 and then a asp:panel with a public variable
inside. In the codebehind I construct the table and set it as the variable
value. This works except for the fact that the asp:panel generates a <div>
tag before the table. The wap browser get messed up with the div tag.

2- Again, a device specific this time with as asp:table inside. I construct
the table in the code behind, adding rows and cells with the correct methods
and it generates a perfect table .... for html browser ..:-((
The wml file that gets sent to the wap browser as the table definition as
follows:
<table id="table1" columns="3" border="0">
This is a problem, since wml tables don't have the border property for the
table. This is so close to what I want, it's easy to develop but .... I need
to get rid of the border !!!

I´m stuck and going nuts with this. Any suggestion would be very
appreciated.

Thanks a lot!!

Pedro Castanheira


2 Answers

Andy Wigley

5/17/2002 6:08:00 PM

0

You could create a mobile user control which represents one line in the
table.
In the user control put your label controls, with literal '<tr><td>' before
the first label, '</td><td>' between the labels and '</td></tr>' after the
last label.

Then on the Form where this is going, put a devicespecific on it. Add two
device filters to it, one for 'isWml11', one 'default'. Then edit templtaes
for each of those two. In the HeaderTemplate for 'isWML11' put the markup
to open the Table in WML, in the Headertemplate for 'default', open the
table for HTML. In the two FooterTemplates, put the markup to close the
template (is the same: "<\table>).

Then in your code behind, for each row you want to create, use:
MobileUserControl muc = this.LoadControl("mytablerowusercontrol.aspx");
this.Formwherethetableis.Controls.AddAt(Formwherethetableis.Controls.Count -
1, muc);

Change the index which is param1 of AddAt to ensure that your rows get
positioned at the correct position in the Form's controls collection.
You can set properties of the Labels in the user control by using syntax
like:
Label the firstLabel = muc.FindControl("label1") as Label;
thefirstlabel.Text = ...

Hope that helps.
- Andy Wigley


"pedro castanheira" <eta@oninet.pt> wrote in message
news:OMsFBqN$BHA.2040@tkmsftngp05...
> I´m developing an application to be used by Mobile Phones.
>
> In one particular page I've a table with two rows and to columns with four
> mobile labels inside. I change the values of the labels in runtime and the
> table displays ok in my wap device.
>
> Now I'm trying to do a dynamic table that can have x rows and always 3
> columns per row.
> I've tried it several ways:
>
> 1- A device specific for WML1.1 and then a asp:panel with a public
variable
> inside. In the codebehind I construct the table and set it as the variable
> value. This works except for the fact that the asp:panel generates a <div>
> tag before the table. The wap browser get messed up with the div tag.
>
> 2- Again, a device specific this time with as asp:table inside. I
construct
> the table in the code behind, adding rows and cells with the correct
methods
> and it generates a perfect table .... for html browser ..:-((
> The wml file that gets sent to the wap browser as the table definition as
> follows:
> <table id="table1" columns="3" border="0">
> This is a problem, since wml tables don't have the border property for the
> table. This is so close to what I want, it's easy to develop but .... I
need
> to get rid of the border !!!
>
> I´m stuck and going nuts with this. Any suggestion would be very
> appreciated.
>
> Thanks a lot!!
>
> Pedro Castanheira
>
>


pedro castanheira

5/17/2002 7:10:00 PM

0

Thanks a lot for your help!
I realy appreciate it.
I´ve managed to do what I wanted in a different manner.
Inside the templates (One for wml11, other for html32) I´ve created a
<asp:literal>.
On my codebehind I have a string variable in which I contruct my table. A
add rows for each new element in a "<tr><td>" & blabla.text.toString &
"</td></tr>" .
In the end I append the closing tag for the table so my var as the encoded
wml table.
Then I just need to find the asp:literal control inside the panel as you did
it in your example a set it's text to the variable. I't works just fine.
I've tried it in several different simulators and it's just as expected.
Thought I'd share this with you all.

TXS.

"Andy Wigley" <andyw@contentmaster.com> wrote in message
news:#Cbul0b$BHA.2520@tkmsftngp05...
> You could create a mobile user control which represents one line in the
> table.
> In the user control put your label controls, with literal '<tr><td>'
before
> the first label, '</td><td>' between the labels and '</td></tr>' after the
> last label.
>
> Then on the Form where this is going, put a devicespecific on it. Add two
> device filters to it, one for 'isWml11', one 'default'. Then edit
templtaes
> for each of those two. In the HeaderTemplate for 'isWML11' put the markup
> to open the Table in WML, in the Headertemplate for 'default', open the
> table for HTML. In the two FooterTemplates, put the markup to close the
> template (is the same: "<\table>).
>
> Then in your code behind, for each row you want to create, use:
> MobileUserControl muc = this.LoadControl("mytablerowusercontrol.aspx");
>
this.Formwherethetableis.Controls.AddAt(Formwherethetableis.Controls.Count -
> 1, muc);
>
> Change the index which is param1 of AddAt to ensure that your rows get
> positioned at the correct position in the Form's controls collection.
> You can set properties of the Labels in the user control by using syntax
> like:
> Label the firstLabel = muc.FindControl("label1") as Label;
> thefirstlabel.Text = ...
>
> Hope that helps.
> - Andy Wigley
>
>
> "pedro castanheira" <eta@oninet.pt> wrote in message
> news:OMsFBqN$BHA.2040@tkmsftngp05...
> > I´m developing an application to be used by Mobile Phones.
> >
> > In one particular page I've a table with two rows and to columns with
four
> > mobile labels inside. I change the values of the labels in runtime and
the
> > table displays ok in my wap device.
> >
> > Now I'm trying to do a dynamic table that can have x rows and always 3
> > columns per row.
> > I've tried it several ways:
> >
> > 1- A device specific for WML1.1 and then a asp:panel with a public
> variable
> > inside. In the codebehind I construct the table and set it as the
variable
> > value. This works except for the fact that the asp:panel generates a
<div>
> > tag before the table. The wap browser get messed up with the div tag.
> >
> > 2- Again, a device specific this time with as asp:table inside. I
> construct
> > the table in the code behind, adding rows and cells with the correct
> methods
> > and it generates a perfect table .... for html browser ..:-((
> > The wml file that gets sent to the wap browser as the table definition
as
> > follows:
> > <table id="table1" columns="3" border="0">
> > This is a problem, since wml tables don't have the border property for
the
> > table. This is so close to what I want, it's easy to develop but .... I
> need
> > to get rid of the border !!!
> >
> > I´m stuck and going nuts with this. Any suggestion would be very
> > appreciated.
> >
> > Thanks a lot!!
> >
> > Pedro Castanheira
> >
> >
>
>