Pansy
7/16/2002 4:29:00 AM
hi,
how do i modify the below given codes to make it such
that, the whole database is displayed out as a table, and
not each row as a table? (coz when i tried those codes
inside my application, the columns are not align
properly...)
i tried to use HeaderTemplate, and put the table start-
tag inside, and the table end-tag inside the
FooterTemplate... but it can't work.
how do i do that? thanks.
-Pansy
>-----Original Message-----
>Below is a sample code that resolve the issue.
>
>ASPX Page
>
><mobile:ObjectList id=ObjectList1 runat="server"
>CommandStyle-StyleReference="subcommand" LabelStyle-
StyleReference="title"
>DataSource="<%# dataSet11 %>" DataMember="Employees">
> <DeviceSpecific>
> <Choice Argument="isHtml32">
> <ItemTemplate><asp:Table id="Table1"
runat="server">
> <asp:TableRow runat=server>
> <asp:TableCell id="cell1"
Visible="true">Order
>Number:</asp:TableCell>
> <asp:TableCell id="cell2" Visible="true">
> <%# ((ObjectListItem)Container)
["LastName"]%>
> </asp:TableCell>
> </asp:TableRow></asp:Table>
> </ItemTemplate>
> </Choice>
> </DeviceSpecific>
> </mobile:ObjectList>
>
>
>CS Code Behind
> private void Page_Load(object sender, System.EventArgs e)
> {
> // Put user code to initialize the page here
>sqlDataAdapter1.Fill(dataSet11);
>Page.DataBind();
>Control ctrlTemp = FindControlFromControlTree
(ObjectList1,"cell1");
>}
>
>private Control FindControlFromControlTree(Control
myControl, string
>controlToFindID)
>{
>int tempCounter = 0;
>Control mcTemp = null;
>if (myControl.HasControls())
>{
>mcTemp = (Control)myControl.FindControl
(controlToFindID);
>if (mcTemp != null)
>return mcTemp;
>else
>{
>for (int i = 0 ; i<myControl.Controls.Count;
i++)
>{
>Control child = (Control)myControl.Controls[i];
>mcTemp = FindControlFromControlTree
(child,controlToFindID);
>if (mcTemp !=null)
>//changed this line if you want to change the seting per
item
> mcTemp.Visible=false;
>}
>}
>}
>return null;
>}
>
>hopes this resolve the issue
>
>AndresS
>
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>You assume all risk for your use. © 2002 Microsoft
Corporation. All rights
>reserved.
>
>.
>