473,800 Members | 3,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Gain sboro"
>
<asp:TableRow >
<asp:TableCel l HorizontalAlign ="Right" Width="150"
>Name:</asp:TableCell>
<asp:TableCel l Width="200" BackColor="Ghos tWhite"
CssClass="colum nRight">
<asp:TextBox ID="txtName" runat="server"
Width="100%"></asp:TextBox>
</asp:TableCell>
<asp:TableCel l Width="20" BackColor="Lave nderBlush">
<asp:RequiredFi eldValidator ID="valRequireN ame"
runat="server"
ErrorMessage="N ame is required"
ControlToValida te="txtName">* </asp:RequiredFie ldValidator>
</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 1526
Here are several things to take note of:

1. Why are you putting the TextBox and RequiredFieldVa lidator in separate
TableCells?
2. When the ErrorMessage for the RequiredFieldVa lidator 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 RequiredFieldVa lidator?

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********@hotm ail.com
http://www.nathansokalski.com/

"Jeff" <it************ @hotmail.com.NO SPAMwrote in message
news:en******** ******@TK2MSFTN GP03.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="Gain sboro"
<asp:TableRow >
<asp:TableCel l HorizontalAlign ="Right" Width="150"
Name:</asp:TableCell>
<asp:TableCel l Width="200" BackColor="Ghos tWhite"
CssClass="colum nRight">
<asp:TextBox ID="txtName" runat="server"
Width="100%"></asp:TextBox>
</asp:TableCell>
<asp:TableCel l Width="20" BackColor="Lave nderBlush">
<asp:RequiredFi eldValidator ID="valRequireN ame"
runat="server"
ErrorMessage="N ame is required"
ControlToValida te="txtName">* </asp:RequiredFie ldValidator>
</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
3180
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! http://www.pocellular.com ==================================================
2
36523
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 HTML it works just fine with: <img src="foo.gif" width="100%" height="100"> But if I try to create it within the javascript, it will not work.
1
3179
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 boundary. Netscape 7 should have better css support; however, it just give me headache sometime. Any suggestion? Thanks in advace.
2
2828
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 language=\"javascript\">"; script += "var winOptions = 'fullscreen=no, channelmode=no,status=no,toolbar=no,
1
3834
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 getting values from the textboxes in my repeater. It turns out I am not and I can't see what I'm doing wrong. I've had this problem before and just ended up taking a different route to avoid it. Now I REALLY need to figure out what I'm doing...
1
1117
by: roni | last post by:
in datagrid control , how can i change the width of textbox in edit mode (on <asp:BoundColumn> ) ?
2
7319
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 whatever it needs to the text property. Initially I had trouble with getting the textbox to refresh as-the-program ran, but the TextBox.Refresh() method took care of that for me.
2
2707
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, # ctrl+v to paste, and ctrl+/ to select all # count words in a text and show the first ten items # by decreasing frequency
1
6343
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 the following "DateTextBox" class module). Whenever a user enters in to the textbox, the code displays "Please enter date in mm/dd/yyyy format (for ex: 01/01/2009)." message which is accomplished using "MouseUp" event. And, I used "Exit" event to...
0
10281
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10256
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9095
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7584
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6824
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5612
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2953
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.