Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Wrapping Columns 2nd Request


Message #1 by "Adam Harris" <adam@w...> on Tue, 16 Apr 2002 01:26:25 -0400
Hey Guys I'm just checking to see if any knows about this one,

I am using the below code to edit a member's information:

<form runat="server">

  <ASP:DataGrid id="MyDataGrid" runat="server"
       CellPadding = "2"
    HeaderStyle-HorizontalAlign="Center"
 HeaderStyle-BackColor="#FFFFFF"
       EditItemStyle-BackColor="yellow"
    ItemStyle-BackColor="yellow"
    AlternatingEditItemStyle-BackColor="#ffff99"
       DataKeyField="memberid"
       OnEditCommand="DoItemEdit"
       OnUpdateCommand="DoItemUpdate"
       OnCancelCommand="DoItemCancel"
       AutoGenerateColumns="False">

    <Columns>

      <ASP:BoundColumn DataField="memberid" HeaderText="Memberid"
ReadOnly="True" />
   <ASP:BoundColumn DataField="first_name" HeaderText="First Name" />
     <ASP:BoundColumn DataField="last_name" HeaderText="Last Name" />
  <ASP:BoundColumn DataField="password" HeaderText="Password" />
   <ASP:BoundColumn DataField="address1" HeaderText="Addr 1" />
    <ASP:BoundColumn DataField="address2" HeaderText="Addr 2" />
     <ASP:BoundColumn DataField="city" HeaderText="City" />
   <ASP:BoundColumn DataField="state" HeaderText="State" />
   <ASP:BoundColumn DataField="zip" HeaderText="Zip/Postal" />
    <ASP:BoundColumn DataField="country" HeaderText="Country" />
     <ASP:BoundColumn DataField="phone" HeaderText="Phone" />
   <ASP:BoundColumn DataField="email" HeaderText="Email" />
      <ASP:EditCommandColumn
           EditText="Edit"
           CancelText="Cancel"
           UpdateText="Update" />

    </Columns>

  </ASP:DataGrid>

</form>

As you can see, that's a lot of columns for one row.  My question is, how do
I tell the datagrid to put half of these columns on another row?  Thanks!

Adam Harris


Message #2 by "Jon Maz" <jonmaz@s...> on Wed, 17 Apr 2002 23:19:05
Hi Adam,

I don't know if this "wrapping" you want is possible, but an alternative 
solution might be to have template columns replacing some of your bound 
columns, and in each template column you could stack a few web controls 
vertically to display your data.

<Columns>
				
<asp:TemplateColumn>
 <EditItemTemplate>
   <Label / Textbox for memberid>
   <br>
   <Label / Textbox for first_name>
   <br>
   <Label / Textbox for last_name>
   <br>
   <Label / Textbox for password>
 </EditItemTemplate>
</asp:TemplateColumn>

That way you won't need so many columns, and should be able to fit 
everything on one screen (which I'm guessing is the problem).

hth,

JON


  Return to Index