J
JB
Hello
I using ASP.NET and dragged a GridView who’s datasource is a DataSet
onto the web page. One of the columns in the dataset is a description and
one of the columns in the dataset holds comments. I dragged the GridView
from the toolbox so all of the columns in the GridView are of the default
size. The problem is that once I start paging thru the GridView sometimes
the description column and/or the comments column in the datasource/dataset
contain a lot more text than the default size of the GridView column when it
was dragged onto the web page. Consequently when one of those description or
comments columns full of data from the datasource/dataset populates the
GridView it forces the corresponding Gridview column to expand beyond its
default size thereby causing the GridView to stop paging anymore. I have
used “Wrap=true†and changing the size properties but it doesn’t help. How
can I change the GridView columns so that it will support the description and
comments column when they are full of text from datasource? The following
is the markup:
<asp:GridView ID="PGrid" AllowPaging="True" BorderStyle="Solid"
OnPageIndexChanging="PGrid_PageIndexChanged" PageSize="5" Height="50px"
Width="1100px"
AutoGenerateColumns="False" runat="server"
onrowdatabound="PGrid_RowDataBound" >
<Columns>
<asp:TemplateField HeaderText="PID#" SortExpression="PID">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("PID") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("PID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="C Type" SortExpression="CID">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%#
Bind("CID") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("CID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Coming" SortExpression="Coming">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%#
Bind("Coming") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%#
Bind("Coming") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Going" SortExpression="Going">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%#
Bind("Going") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%#
Bind("Going") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Desc" SortExpression="Desc">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" Wrap="true"
TextMode="MultiLine" runat="server" Text='<%# Bind("Pro") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%#
Bind("Pro") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Comments"
SortExpression="IComments">
<EditItemTemplate>
<asp:TextBox ID="TextBox6" Wrap="true"
TextMode="MultiLine" runat="server"
Text='<%# Bind("IComments") %>'> </asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%#
Bind("IComments") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="C Date Time" SortExpression="C
Date Time">
<EditItemTemplate>
<asp:TextBox ID="TextBox7" runat="server" Text='<%#
Bind("CDateTime", "{0:M-dd-yyyy}" ) %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%#
Bind("CDateTime") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Dpatch Date Time"
SortExpression="Dpatch Date Time">
<EditItemTemplate>
<asp:TextBox ID="TextBox8" runat="server"
Text='<%# Bind("DDateTime") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%#
Bind("DDateTime") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="R Date Time"
SortExpression="R Date Time">
<EditItemTemplate>
<asp:TextBox ID="TextBox9" runat="server"
Text='<%# Bind("RDateTime") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%#
Bind("RDateTime") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
JB
I using ASP.NET and dragged a GridView who’s datasource is a DataSet
onto the web page. One of the columns in the dataset is a description and
one of the columns in the dataset holds comments. I dragged the GridView
from the toolbox so all of the columns in the GridView are of the default
size. The problem is that once I start paging thru the GridView sometimes
the description column and/or the comments column in the datasource/dataset
contain a lot more text than the default size of the GridView column when it
was dragged onto the web page. Consequently when one of those description or
comments columns full of data from the datasource/dataset populates the
GridView it forces the corresponding Gridview column to expand beyond its
default size thereby causing the GridView to stop paging anymore. I have
used “Wrap=true†and changing the size properties but it doesn’t help. How
can I change the GridView columns so that it will support the description and
comments column when they are full of text from datasource? The following
is the markup:
<asp:GridView ID="PGrid" AllowPaging="True" BorderStyle="Solid"
OnPageIndexChanging="PGrid_PageIndexChanged" PageSize="5" Height="50px"
Width="1100px"
AutoGenerateColumns="False" runat="server"
onrowdatabound="PGrid_RowDataBound" >
<Columns>
<asp:TemplateField HeaderText="PID#" SortExpression="PID">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("PID") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("PID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="C Type" SortExpression="CID">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%#
Bind("CID") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("CID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Coming" SortExpression="Coming">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%#
Bind("Coming") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%#
Bind("Coming") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Going" SortExpression="Going">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%#
Bind("Going") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%#
Bind("Going") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Desc" SortExpression="Desc">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" Wrap="true"
TextMode="MultiLine" runat="server" Text='<%# Bind("Pro") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%#
Bind("Pro") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Comments"
SortExpression="IComments">
<EditItemTemplate>
<asp:TextBox ID="TextBox6" Wrap="true"
TextMode="MultiLine" runat="server"
Text='<%# Bind("IComments") %>'> </asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%#
Bind("IComments") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="C Date Time" SortExpression="C
Date Time">
<EditItemTemplate>
<asp:TextBox ID="TextBox7" runat="server" Text='<%#
Bind("CDateTime", "{0:M-dd-yyyy}" ) %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%#
Bind("CDateTime") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Dpatch Date Time"
SortExpression="Dpatch Date Time">
<EditItemTemplate>
<asp:TextBox ID="TextBox8" runat="server"
Text='<%# Bind("DDateTime") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%#
Bind("DDateTime") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="R Date Time"
SortExpression="R Date Time">
<EditItemTemplate>
<asp:TextBox ID="TextBox9" runat="server"
Text='<%# Bind("RDateTime") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%#
Bind("RDateTime") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
JB