By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

Cell not inset if blank

P: n/a
If you have nothing in a cell, the cell doesn't have the inset appearance
that all the other cells do.

Normally, you could just put a "&ndsp;" in the cell if the it is blank.

But how do you do this if you are binding it?

<asp:TemplateColumn Visible="true" HeaderText="JobTitle"
ItemStyle-Font-Bold="true"
ItemStyle-Width="195px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Label ID="JobTitle" Text='<%#
Container.DataItem("JobTitleShort")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>

Is there a way to say that if the cell is blank (or null entry), to put an
"&ndsp;" in it (or something that would fix the inset problem)?

Thanks,

Tom
Nov 28 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Did you test it to observe that the "&nbsp;" is not there? I think, Asp.Net
takes care about it and does put a "&nbsp;" character in empty cells.

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
If you have nothing in a cell, the cell doesn't have the inset appearance
that all the other cells do.

Normally, you could just put a "&ndsp;" in the cell if the it is blank.

But how do you do this if you are binding it?

<asp:TemplateColumn Visible="true" HeaderText="JobTitle"
ItemStyle-Font-Bold="true"
ItemStyle-Width="195px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Label ID="JobTitle" Text='<%#
Container.DataItem("JobTitleShort")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>

Is there a way to say that if the cell is blank (or null entry), to put an
"&ndsp;" in it (or something that would fix the inset problem)?

Thanks,

Tom

Nov 28 '05 #2

P: n/a
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...
Did you test it to observe that the "&nbsp;" is not there? I think, Asp.Net takes care about it and does put a "&nbsp;" character in empty cells.
If it does, I assume that there must be some setting to make it do that.

Here is one row from my Datagrid:

<td valign="Top" style="font-weight:bold;width:195px;">
<span id="InProgressGrid__ctl2_JobTitle">Assistant Controller</span>
</td><td valign="Top" style="width:231px;">
<span id="InProgressGrid__ctl2_Category">Accounting/Auditing </span>
</td><td valign="Top" style="width:88px;">
<span id="InProgressGrid__ctl2_DateCreated">06/16/2005</span>
</td><td valign="Top" style="width:70px;">
<span id="InProgressGrid__ctl2_TimeCreated">12:00AM</span>
</td><td valign="Top" style="width:167px;">
<span id="InProgressGrid__ctl2_FullName"></span>
<-------
</td><td class="tdCenter" valign="Top" style="width:40px;">
<input type="image" name="InProgressGrid:_ctl2:ViewButton"
id="InProgressGrid__ctl2_ViewButton" align="absmiddle"
src="../../images/new24-32.gif" alt="" border="0"
style="height:13px;width:13px;" />
</td>

As you can see, it creates Spans for each cell. But if you look at the
FullName Span, there is nothing between the spans.

Tom
Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
If you have nothing in a cell, the cell doesn't have the inset appearance that all the other cells do.

Normally, you could just put a "&ndsp;" in the cell if the it is blank.

But how do you do this if you are binding it?

<asp:TemplateColumn Visible="true" HeaderText="JobTitle"
ItemStyle-Font-Bold="true"
ItemStyle-Width="195px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Label ID="JobTitle" Text='<%#
Container.DataItem("JobTitleShort")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>

Is there a way to say that if the cell is blank (or null entry), to put an "&ndsp;" in it (or something that would fix the inset problem)?

Thanks,

Tom


Nov 28 '05 #3

P: n/a
The cell is not blank. It has a <span> inside, that's why asp.net doesn'
produce an "&nbsp;".

Replace the Label with a Literal and the <span> will go:

<itemtemplate>
<asp:Literal ID="JobTitle" Text='<%# Container.DataItem("JobTitleShort")%>'
runat="server" />
</itemtemplate>

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eX*************@TK2MSFTNGP11.phx.gbl...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...
Did you test it to observe that the "&nbsp;" is not there? I think,

Asp.Net
takes care about it and does put a "&nbsp;" character in empty cells.


If it does, I assume that there must be some setting to make it do that.

Here is one row from my Datagrid:

<td valign="Top" style="font-weight:bold;width:195px;">
<span id="InProgressGrid__ctl2_JobTitle">Assistant Controller</span>
</td><td valign="Top" style="width:231px;">
<span id="InProgressGrid__ctl2_Category">Accounting/Auditing </span>
</td><td valign="Top" style="width:88px;">
<span id="InProgressGrid__ctl2_DateCreated">06/16/2005</span>
</td><td valign="Top" style="width:70px;">
<span id="InProgressGrid__ctl2_TimeCreated">12:00AM</span>
</td><td valign="Top" style="width:167px;">
<span id="InProgressGrid__ctl2_FullName"></span>
<-------
</td><td class="tdCenter" valign="Top" style="width:40px;">
<input type="image" name="InProgressGrid:_ctl2:ViewButton"
id="InProgressGrid__ctl2_ViewButton" align="absmiddle"
src="../../images/new24-32.gif" alt="" border="0"
style="height:13px;width:13px;" />
</td>

As you can see, it creates Spans for each cell. But if you look at the
FullName Span, there is nothing between the spans.

Tom

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
> If you have nothing in a cell, the cell doesn't have the inset appearance > that all the other cells do.
>
> Normally, you could just put a "&ndsp;" in the cell if the it is blank.
>
> But how do you do this if you are binding it?
>
> <asp:TemplateColumn Visible="true" HeaderText="JobTitle"
> ItemStyle-Font-Bold="true"
> ItemStyle-Width="195px" ItemStyle-VerticalAlign="Top">
> <itemtemplate>
> <asp:Label ID="JobTitle" Text='<%#
> Container.DataItem("JobTitleShort")%>' runat="server"/>
> </itemtemplate>
> </asp:TemplateColumn>
>
> Is there a way to say that if the cell is blank (or null entry), to put an > "&ndsp;" in it (or something that would fix the inset problem)?
>
> Thanks,
>
> Tom
>
>



Nov 28 '05 #4

P: n/a
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:um*************@TK2MSFTNGP10.phx.gbl...
The cell is not blank. It has a <span> inside, that's why asp.net doesn'
produce an "&nbsp;".

Replace the Label with a Literal and the <span> will go:

<itemtemplate>
<asp:Literal ID="JobTitle" Text='<%#
Container.DataItem("JobTitleShort")%>' runat="server" />
</itemtemplate>
I tried that and the span does go away, but the code generated for a null is
still blank. Here is the code generated. All 3 are Literals but there is
no &nbsp; in the last 2 which are null, so the cell doesn't show correctly.

</td><td valign="Top" style="width:231px;">
Aerospace/Aviation/Defense
</td><td valign="Top" style="width:88px;">

</td><td valign="Top" style="width:70px;">

</td><td valign="Top" style="width:167px;">

Here is the asp code for the 3 templates:

<asp:TemplateColumn Visible="true" HeaderText="Category"
ItemStyle-Width="231px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="Category" Text='<%#
Container.DataItem("JobCategories")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>
<asp:TemplateColumn Visible="true" HeaderText="Submitted On"
ItemStyle-Width="88px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="DateCreated" Text='<%#
Container.DataItem("DateCreated")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>
<asp:TemplateColumn Visible="true" HeaderText="Time"
HeaderStyle-Font-Underline="true" ItemStyle-Width="70px"
ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="TimeCreated" Text='<%#
Container.DataItem("TimeCreated")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>

Do I need to do something to put the &nbsp; in?

Tom

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eX*************@TK2MSFTNGP11.phx.gbl...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...
Did you test it to observe that the "&nbsp;" is not there? I think,

Asp.Net
takes care about it and does put a "&nbsp;" character in empty cells.


If it does, I assume that there must be some setting to make it do that.

Here is one row from my Datagrid:

<td valign="Top" style="font-weight:bold;width:195px;">
<span id="InProgressGrid__ctl2_JobTitle">Assistant Controller</span>
</td><td valign="Top" style="width:231px;">
<span id="InProgressGrid__ctl2_Category">Accounting/Auditing </span>
</td><td valign="Top" style="width:88px;">
<span id="InProgressGrid__ctl2_DateCreated">06/16/2005</span>
</td><td valign="Top" style="width:70px;">
<span id="InProgressGrid__ctl2_TimeCreated">12:00AM</span>
</td><td valign="Top" style="width:167px;">
<span id="InProgressGrid__ctl2_FullName"></span>
<-------
</td><td class="tdCenter" valign="Top" style="width:40px;">
<input type="image" name="InProgressGrid:_ctl2:ViewButton"
id="InProgressGrid__ctl2_ViewButton" align="absmiddle"
src="../../images/new24-32.gif" alt="" border="0"
style="height:13px;width:13px;" />
</td>

As you can see, it creates Spans for each cell. But if you look at the
FullName Span, there is nothing between the spans.

Tom

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
> If you have nothing in a cell, the cell doesn't have the inset

appearance
> that all the other cells do.
>
> Normally, you could just put a "&ndsp;" in the cell if the it is
> blank.
>
> But how do you do this if you are binding it?
>
> <asp:TemplateColumn Visible="true" HeaderText="JobTitle"
> ItemStyle-Font-Bold="true"
> ItemStyle-Width="195px" ItemStyle-VerticalAlign="Top">
> <itemtemplate>
> <asp:Label ID="JobTitle" Text='<%#
> Container.DataItem("JobTitleShort")%>' runat="server"/>
> </itemtemplate>
> </asp:TemplateColumn>
>
> Is there a way to say that if the cell is blank (or null entry), to
> put

an
> "&ndsp;" in it (or something that would fix the inset problem)?
>
> Thanks,
>
> Tom
>
>



Dec 2 '05 #5

P: n/a
You can always use PreRender event to loop through the items, check if the
literals are empty and set them to "&nbsp;"

Eliyahu

"tshad" <ts**********@ftsolutions.com> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:um*************@TK2MSFTNGP10.phx.gbl...
The cell is not blank. It has a <span> inside, that's why asp.net doesn'
produce an "&nbsp;".

Replace the Label with a Literal and the <span> will go:

<itemtemplate>
<asp:Literal ID="JobTitle" Text='<%#
Container.DataItem("JobTitleShort")%>' runat="server" />
</itemtemplate>


I tried that and the span does go away, but the code generated for a null
is still blank. Here is the code generated. All 3 are Literals but there
is no &nbsp; in the last 2 which are null, so the cell doesn't show
correctly.

</td><td valign="Top" style="width:231px;">
Aerospace/Aviation/Defense
</td><td valign="Top" style="width:88px;">

</td><td valign="Top" style="width:70px;">

</td><td valign="Top" style="width:167px;">

Here is the asp code for the 3 templates:

<asp:TemplateColumn Visible="true" HeaderText="Category"
ItemStyle-Width="231px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="Category" Text='<%#
Container.DataItem("JobCategories")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>
<asp:TemplateColumn Visible="true" HeaderText="Submitted On"
ItemStyle-Width="88px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="DateCreated" Text='<%#
Container.DataItem("DateCreated")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>
<asp:TemplateColumn Visible="true" HeaderText="Time"
HeaderStyle-Font-Underline="true" ItemStyle-Width="70px"
ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="TimeCreated" Text='<%#
Container.DataItem("TimeCreated")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>

Do I need to do something to put the &nbsp; in?

Tom

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eX*************@TK2MSFTNGP11.phx.gbl...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...
Did you test it to observe that the "&nbsp;" is not there? I think,
Asp.Net
takes care about it and does put a "&nbsp;" character in empty cells.

If it does, I assume that there must be some setting to make it do that.

Here is one row from my Datagrid:

<td valign="Top" style="font-weight:bold;width:195px;">
<span id="InProgressGrid__ctl2_JobTitle">Assistant Controller</span>
</td><td valign="Top" style="width:231px;">
<span id="InProgressGrid__ctl2_Category">Accounting/Auditing </span>
</td><td valign="Top" style="width:88px;">
<span id="InProgressGrid__ctl2_DateCreated">06/16/2005</span>
</td><td valign="Top" style="width:70px;">
<span id="InProgressGrid__ctl2_TimeCreated">12:00AM</span>
</td><td valign="Top" style="width:167px;">
<span id="InProgressGrid__ctl2_FullName"></span>
<-------
</td><td class="tdCenter" valign="Top" style="width:40px;">
<input type="image" name="InProgressGrid:_ctl2:ViewButton"
id="InProgressGrid__ctl2_ViewButton" align="absmiddle"
src="../../images/new24-32.gif" alt="" border="0"
style="height:13px;width:13px;" />
</td>

As you can see, it creates Spans for each cell. But if you look at the
FullName Span, there is nothing between the spans.

Tom

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
> If you have nothing in a cell, the cell doesn't have the inset
appearance
> that all the other cells do.
>
> Normally, you could just put a "&ndsp;" in the cell if the it is
> blank.
>
> But how do you do this if you are binding it?
>
> <asp:TemplateColumn Visible="true" HeaderText="JobTitle"
> ItemStyle-Font-Bold="true"
> ItemStyle-Width="195px" ItemStyle-VerticalAlign="Top">
> <itemtemplate>
> <asp:Label ID="JobTitle" Text='<%#
> Container.DataItem("JobTitleShort")%>' runat="server"/>
> </itemtemplate>
> </asp:TemplateColumn>
>
> Is there a way to say that if the cell is blank (or null entry), to
> put
an
> "&ndsp;" in it (or something that would fix the inset problem)?
>
> Thanks,
>
> Tom
>
>



Dec 4 '05 #6

P: n/a
I could.

I was just looking for a way around this.

I have a page that has 6 Datagrids and it would add a little more processing
to do this. I was hoping there was a way to do, as you mentioned with the
Literal object, which would have been a good way to solve the problem.

Thanks,

Tom

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eW****************@TK2MSFTNGP09.phx.gbl...
You can always use PreRender event to loop through the items, check if the
literals are empty and set them to "&nbsp;"

Eliyahu

"tshad" <ts**********@ftsolutions.com> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:um*************@TK2MSFTNGP10.phx.gbl...
The cell is not blank. It has a <span> inside, that's why asp.net doesn'
produce an "&nbsp;".

Replace the Label with a Literal and the <span> will go:

<itemtemplate>
<asp:Literal ID="JobTitle" Text='<%#
Container.DataItem("JobTitleShort")%>' runat="server" />
</itemtemplate>


I tried that and the span does go away, but the code generated for a null
is still blank. Here is the code generated. All 3 are Literals but
there is no &nbsp; in the last 2 which are null, so the cell doesn't show
correctly.

</td><td valign="Top" style="width:231px;">
Aerospace/Aviation/Defense
</td><td valign="Top" style="width:88px;">

</td><td valign="Top" style="width:70px;">

</td><td valign="Top" style="width:167px;">

Here is the asp code for the 3 templates:

<asp:TemplateColumn Visible="true" HeaderText="Category"
ItemStyle-Width="231px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="Category" Text='<%#
Container.DataItem("JobCategories")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>
<asp:TemplateColumn Visible="true" HeaderText="Submitted On"
ItemStyle-Width="88px" ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="DateCreated" Text='<%#
Container.DataItem("DateCreated")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>
<asp:TemplateColumn Visible="true" HeaderText="Time"
HeaderStyle-Font-Underline="true" ItemStyle-Width="70px"
ItemStyle-VerticalAlign="Top">
<itemtemplate>
<asp:Literal ID="TimeCreated" Text='<%#
Container.DataItem("TimeCreated")%>' runat="server"/>
</itemtemplate>
</asp:TemplateColumn>

Do I need to do something to put the &nbsp; in?

Tom

Eliyahu

"tshad" <tf*@dslextreme.com> wrote in message
news:eX*************@TK2MSFTNGP11.phx.gbl...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...
> Did you test it to observe that the "&nbsp;" is not there? I think,
Asp.Net
> takes care about it and does put a "&nbsp;" character in empty cells.

If it does, I assume that there must be some setting to make it do
that.

Here is one row from my Datagrid:

<td valign="Top" style="font-weight:bold;width:195px;">
<span id="InProgressGrid__ctl2_JobTitle">Assistant Controller</span>
</td><td valign="Top" style="width:231px;">
<span id="InProgressGrid__ctl2_Category">Accounting/Auditing </span>
</td><td valign="Top" style="width:88px;">
<span id="InProgressGrid__ctl2_DateCreated">06/16/2005</span>
</td><td valign="Top" style="width:70px;">
<span id="InProgressGrid__ctl2_TimeCreated">12:00AM</span>
</td><td valign="Top" style="width:167px;">
<span id="InProgressGrid__ctl2_FullName"></span>
<-------
</td><td class="tdCenter" valign="Top" style="width:40px;">
<input type="image" name="InProgressGrid:_ctl2:ViewButton"
id="InProgressGrid__ctl2_ViewButton" align="absmiddle"
src="../../images/new24-32.gif" alt="" border="0"
style="height:13px;width:13px;" />
</td>

As you can see, it creates Spans for each cell. But if you look at the
FullName Span, there is nothing between the spans.

Tom
>
> Eliyahu
>
> "tshad" <tf*@dslextreme.com> wrote in message
> news:eB**************@TK2MSFTNGP10.phx.gbl...
> > If you have nothing in a cell, the cell doesn't have the inset
appearance
> > that all the other cells do.
> >
> > Normally, you could just put a "&ndsp;" in the cell if the it is
> > blank.
> >
> > But how do you do this if you are binding it?
> >
> > <asp:TemplateColumn Visible="true" HeaderText="JobTitle"
> > ItemStyle-Font-Bold="true"
> > ItemStyle-Width="195px" ItemStyle-VerticalAlign="Top">
> > <itemtemplate>
> > <asp:Label ID="JobTitle" Text='<%#
> > Container.DataItem("JobTitleShort")%>' runat="server"/>
> > </itemtemplate>
> > </asp:TemplateColumn>
> >
> > Is there a way to say that if the cell is blank (or null entry), to
> > put
an
> > "&ndsp;" in it (or something that would fix the inset problem)?
> >
> > Thanks,
> >
> > Tom
> >
> >
>
>



Dec 5 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.