473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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?
Oct 8 '08 #1
1 1503
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
nj********@hotmail.com
http://www.nathansokalski.com/

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:en**************@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?

Oct 8 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alex Shi | last post by:
In php, is there a way obtain the width of a charactor of a certain font? Alex -- ================================================== Cell Phone Batteries at 30-50%+ off retail prices!...
2
by: Catherine Lynn Smith | last post by:
I want to use javascript to build page elements using onLoad but I seem to be having trouble defining the width value of an IMG tag if I create it with javascript. If I build the element with...
1
by: Alex Peng | last post by:
I have the following code. For IE 6, I can get link one and link two in two separated lines, but not in Netscape 7. I try to set display:block for A.ccMenu; however, the hyperlink excess ccMenuBox...
2
by: Newbie | last post by:
I'm having trouble changing the width of my pop up window. Changing the width has no effect. private void LinkButton1_Click(object sender, System.EventArgs e) { string script = "<script...
1
by: MattB | last post by:
OK, never mind my last post. It was easy enough to refer to the table the repeater is bound to, but I made a big, incorrect assumption in that post. In my last post I thought I was successfully...
1
by: roni | last post by:
in datagrid control , how can i change the width of textbox in edit mode (on <asp:BoundColumn> ) ?
2
by: sherifffruitfly | last post by:
Hi all, I'm using a multiline+scrollbar textbox to log output as my program runs. Basically, I pass a reference to the class instance that's currently doing stuff, and the instance can tack on...
2
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, #...
1
by: JFKJr | last post by:
Hello everyone, the following Access VBA code opens an excel file and creates textboxes in a given range of cells dynamically. The code attaches "MouseUP" and "Exit" events to the textboxes (using...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.