Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / November 2007

Tip: Looking for answers? Try searching our database.

wrapping text in datagrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ireallyneedtoknow2007@yahoo.com - 11 Nov 2007 18:36 GMT
hello I am trying to wrap the text in the contact_email cell of a
datagrid in asp.net 2.0 and tried many variations of the code below.
the asp:TemplateColumn HeaderText="Email" wraps as expected but I
cannot get the asp:BoundColumn Visible="False"
DataField="contact_email" field to wrap at all.

thanks for any suggestions

public void myDataGrid_PreRender(object sender, System.EventArgs e)
{
    myDataGrid.Columns[5].ItemStyle.Width = 3;
    myDataGrid.Columns[5].ItemStyle.Wrap = true;
}

<asp:datagrid id="myDataGrid" style="Z-INDEX: 100; LEFT: 20px;
POSITION: absolute; TOP: 260px"
    OnItemDataBound="myDataGrid_ItemDataBound" runat="server"
OnPageIndexChanged="myDataGrid_PageIndexChanged"
    OnDeleteCommand="myDataGrid_DeleteRow"
OnEditCommand="myDataGrid_EditCommand"
OnCancelCommand="myDataGrid_CancelCommand"
    OnUpdateCommand="myDataGrid_UpdateCommand" AllowSorting="True"
AllowPaging="True" Font-Size="X-Small"
    Font-Names="Verdana" ForeColor="Black" GridLines="None"
CellPadding="2" BackColor="LightGoldenrodYellow"
    BorderWidth="1px" BorderColor="Tan" Width="900px" Height="304px"
AutoGenerateColumns="False" OnPreRender="myDataGrid_PreRender">
    <FooterStyle BackColor="#BBD7BB"></FooterStyle>
    <SelectedItemStyle ForeColor="GhostWhite" BackColor="DarkSlateBlue"></
SelectedItemStyle>
    <AlternatingItemStyle BackColor="PaleGoldenrod"></
AlternatingItemStyle>
    <HeaderStyle Font-Bold="True" BackColor="Tan"></HeaderStyle>
    <Columns>
        <asp:BoundColumn DataField="Sender" ReadOnly="True"
HeaderText="Sender" ItemStyle-Wrap=true></asp:BoundColumn>
        <asp:BoundColumn DataField="Receiver" ReadOnly="True"
HeaderText="Receiver" ItemStyle-Wrap=true></asp:BoundColumn>
        <asp:BoundColumn DataField="Doc_Type" ReadOnly="True"
HeaderText="Doc Type" ItemStyle-Wrap=true></asp:BoundColumn>
        <asp:BoundColumn DataField="Route" ReadOnly="True"
HeaderText="Route" ItemStyle-Wrap=true></asp:BoundColumn>
        <asp:BoundColumn Visible="False" DataField="contact_email"
ReadOnly="True" HeaderText="Email" ItemStyle-Wrap=true>
        </asp:BoundColumn>
        <asp:TemplateColumn HeaderText="Email" ItemStyle-Width="10px"
FooterStyle-Width="10px"  HeaderStyle-Width="10px"
             ItemStyle-Wrap=true FooterStyle-Wrap=true HeaderStyle-Wrap=true>
            <ItemTemplate>
                <%# DataBinder.Eval(Container.DataItem, "contact_email") %>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox id=TextBox1 runat="server" Wrap=True
TextMode=MultiLine Width=300 Text='<%#
DataBinder.Eval(Container.DataItem,"contact_email") %>'>
                </asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="Duplicate" ItemStyle-Wrap=true >
            <ItemTemplate>
                <asp:CheckBox id=chk runat="server" AutoPostBack="true"
OnCheckedChanged="oncheckchanged" Checked='<
%#IsCheck(DataBinder.Eval(Container.DataItem, "Duplicate")) %>'>
                </asp:CheckBox>
            </ItemTemplate>
        </asp:TemplateColumn>

        <asp:EditCommandColumn UpdateText="Update" HeaderText="Edit"
CancelText="Cancel"
            EditText="Edit" ItemStyle-Wrap=true></asp:EditCommandColumn>
        <asp:ButtonColumn Visible="False" Text="Delete" HeaderText="Delete"
CommandName="Delete"></asp:ButtonColumn>
        <asp:TemplateColumn HeaderText="Delete">
        <ItemStyle Wrap=true />
            <ItemTemplate>
                <asp:linkbutton id="btnDelete" CommandName="Delete"
OnClick="setviewstate" runat="Server" Text="Delete"
                    ForeColor="#000000" />
            </ItemTemplate>
        </asp:TemplateColumn>
    </Columns>
    <PagerStyle HorizontalAlign="Center" ForeColor="DarkSlateBlue"
BackColor="PaleGoldenrod" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
Alexey Smirnov - 12 Nov 2007 19:27 GMT
On Nov 11, 7:36 pm, ireallyneedtoknow2...@yahoo.com wrote:
> hello I am trying to wrap the text in the contact_email cell of a
> datagrid in asp.net 2.0 and tried many variations of the code below.
[quoted text clipped - 81 lines]
> BackColor="PaleGoldenrod" Mode="NumericPages"></PagerStyle>
> </asp:datagrid>

Look at this:

http://community.sgdotnet.org/blogs/chuawenching/archive/2007/03/22/ASP.NET-2.0-
Autowrapping-in-GridView--_2D00_-Is-that-possible_3F00_.aspx


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.