I have a textbox centered on a page. What I would like to have is an error label display to the right of it, if necessary, and keep the textbox centered on the page. The page contains a Panel, which is centering the entire page.
<asp:Panel ID="pnlStart" runat="server" CssClass="center">
...
...
...
<tr>
<td>
<div>
<input type="text" id="pName" name="pName" runat="server" class="pName" style="color:#7A0000;width:33%;"
value="Enter Your Name" onfocus="inputFocus(this)" onblur="inputBlur(this)" />
<asp:Label ID="pNameValidationLabel" style="width:33%;" name="pName" runat="server" Text="*Please enter your name." class="pName" visible="false"></asp:Label>
</div>
</td>
</tr>
On page load, the textbox is centered properly. but when the visibility of the pNameValidate Label appears, it tries to force both object into the Center.
Is there a way for the textbox to be centered and the label off centered, to the right?
Many thanks for looking.
You can try and add text-align:right; to the style tag in the pName element.
I went with a table and this quickly provided me what I needed...
<tr>
<td>
<table width="100%">
<tr>
<td width="33%"> </td>
<td width="33%">
<div id="shaker">
<input type="text" id="pName" autocomplete="false" clientidmode="Static" name="pName" runat="server" class="pName"
value="Please Enter Your Name Here" onfocus="inputFocus(this)" onblur="inputBlur(this)" />
</div>
</td>
</tr>
</table>
</td>
</tr>
Related
I am having lot of space between newly added radiobuttons(yes and No) of the RadioButtonList and the first part of the existing region(divName) is aligned properly.
can any body help me in aligning the newly added second region(div1)
<div id="divpanelFacts" runat="server">
<fieldset id="panelFacts">
<table width="100%">
<tr>
<td>
<div id="divName" runat="server" visible="false">
<span>
<label runat="server" id="Label1">
<span id="pNameSpan" runat="server">*</span>P Name</label>
<asp:TextBox ID="textPName" runat="server" MaxLength="20"></asp:TextBox>
</span>
</div>
</td>
<td>
<div id="div1" runat="server" visible="false">
<asp:Label ID="lbl1" runat="server" Text="Would like to use this option for document purpose"></asp:Label>
<asp:RadioButtonList ID="rbl1" runat="server" TextAlign="Left" RepeatDirection="Horizontal">
<asp:ListItem Value="Yes" Text="Yes" />
<asp:ListItem Value="No" Text="No" Selected="True" />
</asp:RadioButtonList>
</div>
</td>
</tr>
</table>
</fieldset>
</div>
Your table width is at 100%, which means it's going to stretch it, and table I think takes precedence.
As you can see i want to have two or more inputs with samo Id and Name, but HTML doesn't allow that, so how can i solve this on some other way and how to make active button change it's color
<table border="0" cellspacing="0" cellpadding = "0" style="font-size:x-small">
<tr valign="bottom" style="height:10px">
<td width="30px" style="vertical-align: top">
</td>
<td width="30px" style="vertical-align: middle" align="center" nowrap="nowrap">
<label style="font-size:small">
Time period</label>
<input type="hidden" id="ReportParameter" value = "1" name="ReportParameter" />
<input class="button" id="showDailyReport" name="searchQueue" type="submit" value="Day" onClick="onClickHandler(this)" />
<input type="hidden" id="ReportParameter" value = "2" name="ReportParameter"/>
<input class="button" id="showWeeklyReport" name="searchQueue" type="submit" value="Week" onClick="onClickHandler(this)" />
</td>
</tr>
</table>
You can define specific class for every button and do the visual changes on that class
ex
<input class="button button-red" id="showDailyReport" name="searchQueue" type="submit" value="Day" onClick="onClickHandler(this)" />
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I am creating a login page with username and password. I want to put a text heading "Login App" at he top left side of the login panel table. I tried using panel tag but didn't work. You know there is a heading above the login panel or login table on almost any login page? I just want to do that.
Is there a really simple and easy way/tag i can use to do this? I even tried placeholder but couldn't achieve this.
Thanks
Simplest way to have heading to login table is
fieldset and legend
<!DOCTYPE html>
<html>
<head>
<style>
fieldset {position: relative; width:50%}
legend {color:#893039 }
</style>
</head>
<body>
<fieldset>
<legend align="center">Login App:</legend>
<table>
<tr>
<td>Name</td>
<td><input type="text"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password"></td>
</tr>
</table>
</fieldset>
</body>
</html>
working sample is given in jsfiddle in this link:
http://jsfiddle.net/Manirajss/QKeHq/
Just copy the following design and put it in aspx
<h2>
Log In
</h2>
<p>
Please enter your username and password.
<asp:HyperLink ID="RegisterHyperLink" runat="server" EnableViewState="false">Register</asp:HyperLink> if you don't have an account.
</p>
<asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false">
<LayoutTemplate>
<span class="failureNotification">
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
</span>
<asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="failureNotification"
ValidationGroup="LoginUserValidationGroup"/>
<div class="accountInfo">
<fieldset class="login">
<legend>Account Information</legend>
<p>
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>
<asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
<asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:CheckBox ID="RememberMe" runat="server"/>
<asp:Label ID="RememberMeLabel" runat="server" AssociatedControlID="RememberMe" CssClass="inline">Keep me logged in</asp:Label>
</p>
</fieldset>
<p class="submitButton">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="LoginUserValidationGroup"/>
</p>
</div>
</LayoutTemplate>
</asp:Login>
I am working to get a HTML File Upload control in place in a ASPX Web Form page. I have used the below code
<td class="ClientDetailTableLeftColumn">
<asp:Label ID="lblUpload" runat="server" Text="Upload File"></asp:Label>
</td>
<td "ClientDetailTableControls" colspan="2">
<p id="UploadArea">
<input id="FileUploadInput" type="file" size="20"/>
<asp:Button ID="btnUpload" runat="server" Text="Click To Upload" CssClass="btnFormSubmit" />
</p>
<input id="btnUploadMore" type="button" value="Add New Attachment" onclick="AddUploadBox" />
</td>
But while running in Local IIS I am getting an error.
System.Web.UI.HtmlControls.HtmlTableCellCollection must have items of
type System.Web.UI.HtmlControls.HtmlTableCell'. 'p' is of type
System.Web.UI.HtmlControls.HtmlGenericControl'.
The code is failing in the 2nd Line :
Line 85: <td "ClientDetailTableControls" colspan="2">
Line 86: <p id="UploadArea">
Can somebody please help me what could be the resolution to this? Or why is this failing?
Try this
<td class="ClientDetailTableLeftColumn">
<asp:Label ID="lblUpload" runat="server" Text="Upload File"></asp:Label>
</td>
<td "ClientDetailTableControls" colspan="2">
<div id="UploadArea">
<input id="FileUploadInput" type="file" size="20"/>
<asp:Button ID="btnUpload" runat="server" Text="Click To Upload" CssClass="btnFormSubmit" />
</div>
<input id="btnUploadMore" type="button" value="Add New Attachment" onclick="AddUploadBox" />
</td>
I'm experiencing some weird behaviour on my local machine, when I access a page on my test server everything is centered like I want. When I run the code on my local machine everything is left aligned, the centering is ignored.
The HTML is really simple so I don't see why this issue has suddenly started to happen.
<table>
<tr>
<td>
<asp:HyperLink NavigateUrl="" ID="hlPhoto" runat="server"><asp:Image ID="imgPhoto" runat="server" ImageUrl='<%# String.Format( "../images/mugshots/{0}", DataBinder.Eval(Container.DataItem,"Photo") )%>' /></asp:HyperLink>
</td>
</tr>
<tr>
<td valign="bottom" align="center">
<div>
<b>
<asp:Label ID="lblName" runat="server"><%# Eval("FullName")%></asp:Label></b> </div>
<div>
<asp:Label ID="Label1" runat="server"><%# Eval("Jobtitle")%></asp:Label></div>
<div>
<br />
<asp:HyperLink NavigateUrl="" ID="hlDetail" runat="server"><font size="2">Details</font></asp:HyperLink>
</div>
<div>
<asp:HiddenField ID="userID" runat="server" Value='<%# Eval("Jobtitle")%>' />
</div>
</td>