Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Programming > ASP.NET

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-2008, 02:37 AM
Jeff
 
Posts: n/a
trouble with DataCell Width and Width of Textbox

hi

asp.net 2.0

Below is some markup I have trouble with. The problem is that the Textbox
doesn't fill the entire DataCell.
I've set width of TextBox to 100%.... The point is that I want the * to be
aligned exactly at the right corner of the TextBox. As it is now there is a
huge space between them, maybe 30px

<asp:Table ID="tblEditUser" runat="server" Width="370" BackColor="Gainsboro"
>

<asp:TableRow>
<asp:TableCell HorizontalAlign="Right" Width="150"
>Name:</asp:TableCell>

<asp:TableCell Width="200" BackColor="GhostWhite"
CssClass="columnRight">
<asp:TextBox ID="txtName" runat="server"
Width="100%"></asp:TextBox>
</asp:TableCell>
<asp:TableCell Width="20" BackColor="LavenderBlush">
<asp:RequiredFieldValidator ID="valRequireName"
runat="server"
ErrorMessage="Name is required"
ControlToValidate="txtName">*</asp:RequiredFieldValidator>
</asp:TableCell>
</asp:TableRow>

Those colors above is just debug info, I want to see where each DataCell is


any suggestions?


Reply With Quote
  #2 (permalink)  
Old 10-08-2008, 05:18 AM
Nathan Sokalski
 
Posts: n/a
Re: trouble with DataCell Width and Width of Textbox

Here are several things to take note of:

1. Why are you putting the TextBox and RequiredFieldValidator in separate
TableCells?
2. When the ErrorMessage for the RequiredFieldValidator is displayed, the
TableCell it is in will be wider than 20
3. When using the Width and Height properties of the TableCell, you should
put Width="20px", not Width="20"
4. When you are specifying the width and/or height for all cells and/or rows
in a table (server or html), it is a good idea to include
style="table-layout:fixed;"
5. What happens if you add style="text-align:left;" to the TableCell with
the RequiredFieldValidator?

I don't have your entire code, so I can't really do a good test, but see if
any of these suggestions make a difference. Also, just as a personal
preference, I think it is better to use the style="..." attribute rather
than control properties for things that are directly mapped to CSS
properties (such as Width, Height, BackColor, etc.) when specifying them
declaratively so that I can see them all next to each other, and also so
that I know whether they will be rendered as CSS or an attribute of the
rendered HTML tag. Good Luck!
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

"Jeff" <it_consultant1@hotmail.com.NOSPAM> wrote in message
news:enGmFaOKJHA.1556@TK2MSFTNGP03.phx.gbl...
> hi
>
> asp.net 2.0
>
> Below is some markup I have trouble with. The problem is that the Textbox
> doesn't fill the entire DataCell.
> I've set width of TextBox to 100%.... The point is that I want the * to be
> aligned exactly at the right corner of the TextBox. As it is now there is
> a huge space between them, maybe 30px
>
> <asp:Table ID="tblEditUser" runat="server" Width="370"
> BackColor="Gainsboro"
> >

> <asp:TableRow>
> <asp:TableCell HorizontalAlign="Right" Width="150"
> >Name:</asp:TableCell>

> <asp:TableCell Width="200" BackColor="GhostWhite"
> CssClass="columnRight">
> <asp:TextBox ID="txtName" runat="server"
> Width="100%"></asp:TextBox>
> </asp:TableCell>
> <asp:TableCell Width="20" BackColor="LavenderBlush">
> <asp:RequiredFieldValidator ID="valRequireName"
> runat="server"
> ErrorMessage="Name is required"
> ControlToValidate="txtName">*</asp:RequiredFieldValidator>
> </asp:TableCell>
> </asp:TableRow>
>
> Those colors above is just debug info, I want to see where each DataCell
> is
>
> any suggestions?
>



Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Programming > ASP.NET


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:53 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Secured Loans | MySpace Templates | Credit Cards | Mortgage Calculator | Problem Mortgage



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114