I have this asp code:
<table>
<tr>
<td>Text:
</td>
<td>
<asp:TextBox ID="txtDescPoint" runat="server" EnableViewState="False" />
</td>
<td>
<input type="button" value="..." id="ffcolorswtach" style="width: 20px; height: 23px;color: #ffffffff; background-color: #ffffffff" onclick="PickColor(1, false, false)" role="button"/>
</td>
</tr>
<tr>
<td>X:
</td>
<td>
<asp:TextBox ID="txtLon" runat="server" EnableViewState="False" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtLon" Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Y:
</td>
<td>
<asp:TextBox ID="txtLat" runat="server" EnableViewState="False" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtLat" Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
Here how it looks in view:
I need the view like this:
My question is what do I have to change in asp code to make appearance like in picture above?
I'm new to ASP, but I think you can just use CSS/html styling principles.
In
<input type="button" value="..." id="ffcolorswtach" style="width: 20px; height: 23px;color: #ffffffff; background-color: #ffffffff" onclick="PickColor(1, false, false)" role="button"/>
add this somewhere between the quotes after style=
left: 80px; //play with the amount to find what works.
If you're unable to get the button close enough, it may be because the textbox has padding or margin around it. Search your css files for a reference to #txtDescPoint and edit the padding/margin attribute if it has one.
Related
<tr>
<td class="auto-style3" >
<asp:Label ID="Label17" runat="server" CssClass="txtbox" Text="VarCharMax" ></asp:Label></td>
<td class="auto-style4">
<asp:TextBox ID="TextBox3" runat="server" Text='<%#Eval("VarCharMax") %>' autocomplete="off" Width="209px" TextMode="MultiLine" BorderColor="#7A7F81" CssClass="txtbox" >
</asp:TextBox>
</td>
</tr>
Simply modify your existing class like:
.txtbox { border-radius: 4px; }
I'm struggling to get the content of my div to align, everything will center apart from the contents of the table. The title will center along with the login button.
CSS:
.center {
margin:auto;
width: 50%;
border:3px solid #8AC007;
padding: 10px;
-moz-border-radius:8px;
-webkit-border-radius:8px;
font-family:'Century Gothic';
text-align:center;
}
HTML:
<div class="center">
<form id="form1" runat="server">
<h3>
Login Page</h3>
<table >
<tr>
<td>
E-mail address:</td>
<td>
<asp:TextBox ID="UserEmail" runat="server" /></td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
ControlToValidate="UserEmail"
Display="Dynamic"
ErrorMessage="Required"
runat="server" />
</td>
</tr>
<tr>
<td>
Password:</td>
<td>
<asp:TextBox ID="UserPass" TextMode="Password"
runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
ControlToValidate="UserPass"
ErrorMessage="Cannot be empty."
runat="server" />
</td>
</tr>
<tr>
<td>
Remember me?</td>
<td>
<asp:CheckBox ID="Persist" runat="server" /></td>
</tr>
</table>
<asp:Button ID="Submit1" OnClick="Logon_Click" Text="Login"
runat="server" />
<p>
<asp:Label ID="Msg" ForeColor="red" runat="server" />
</p>
</form>
</div>
I've tried text align on the table as well with no luck
Apply margin: 0 auto to the table element. Currently your margin: auto only centers the form but inside it the table is aligned to the left because of the default behavior of contents to start from left.
Don't try to use tables for layout purpose, although you can use them for tabular data.
.center {
margin: auto;
width: 50%;
border: 3px solid #8AC007;
padding: 10px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
font-family: 'Century Gothic';
text-align: center;
}
table {
margin: 0 auto; /* Add */
}
<div class="center">
<form id="form1" runat="server">
<h3>
Login Page</h3>
<table>
<tr>
<td>
E-mail address:</td>
<td>
<asp:TextBox ID="UserEmail" runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="UserEmail" Display="Dynamic" ErrorMessage="Required" runat="server" />
</td>
</tr>
<tr>
<td>
Password:</td>
<td>
<asp:TextBox ID="UserPass" TextMode="Password" runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="UserPass" ErrorMessage="Cannot be empty." runat="server" />
</td>
</tr>
<tr>
<td>
Remember me?</td>
<td>
<asp:CheckBox ID="Persist" runat="server" />
</td>
</tr>
</table>
<asp:Button ID="Submit1" OnClick="Logon_Click" Text="Login" runat="server" />
<p>
<asp:Label ID="Msg" ForeColor="red" runat="server" />
</p>
</form>
</div>
I am new to twitter bootstrap 3.
The problem is the following bootstrap code always Centers the table:
I tried to find a class which may make table so on the left side of page but so far no luck.
Is there such a class and why table show on center?
<div id="registerdiv3" class="row">
<div class="col-lg-5 ">
<table>
<tr>
<td id="regPageTitle">User Registration </td>
</tr>
<tr>
<td>User Name:</td>
<td>
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Password:</td>
<td>
<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Confirm Password:</td>
<td>
<asp:TextBox ID="txtConfirmPassword" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Email:</td>
<td>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="btnRegister" Text="Register" runat="server" OnClick="btnRegister_Click"></asp:Button>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblMessage" CssClass="lblMessage" Text="" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</div>
Force registerdiv3 not to center the table.
#registerdiv3 table {
margin-left: 0px!important;
}
Not sure if you need important, but check also without.
Before the above solution, look at the definition of #registerdiv3 if it contains margin: 0 auto, that might be the cause.
Also it will be helpful for you to right click the on the element in your browser and click inspect element and see which class is causing it.
I've developed a web-application. Unfortunately, i met with some problem in terms of positioning.
As you can see from the image below, the mobile keyboard of my samsung s4 on google chrome caused my element from shifting beyond my header.
However, when i tested it on iPhone 4 with safari, this doesn't happen. Unfortunately, when i tested it on iPhone 4 with google chrome, the same problem persist.
This is how my html of my login page looks like
<div id="loginpage">
<table id="loginpage1" width="100%">
<tr>
<td>
<h2>Login</h2>
<br />
</td>
</tr>
<tr>
<td>
<b> Username : </b> <asp:TextBox ID="txtUsername" runat="server"></asp:TextBox>
<br />
<br />
</td>
</tr>
<tr>
<td>
<b> Password : </b> <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" ></asp:TextBox>
<br />
<br />
</td>
</tr>
</table>
<table id="loginpage2" width="50%" align="center">
<tr>
<td align="right">
<b>Account Type :</b>
</td>
<td>
<asp:RadioButton ID="rbMember" runat="server" GroupName="rbGroup1" Text="Member" />
</td>
<td>
<asp:RadioButton ID="rbPolice" runat="server" GroupName="rbGroup1" Text="Officer" />
</td>
<td>
<asp:RadioButton ID="rbAdmin" runat="server" GroupName="rbGroup1" Text="Admin" />
</td>
<td>
<asp:RadioButton ID="rbSuperior" runat="server" GroupName="rbGroup1" Text="Superior" />
</td>
<td>
<asp:RadioButton ID="rbPoliceStaff" runat="server" GroupName="rbGroup1" Text="PoliceStaff" />
</td>
</tr>
<tr>
<td colspan="6" >
<b><asp:Label ID="lblMessage" runat="server" ></asp:Label></b>
<br />
<br />
</td>
</tr>
<tr>
<td colspan="6">
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" />
<br />
<br />
</td>
</tr>
<tr>
<td colspan="6">
<asp:LinkButton ID="lbtnMemberRegister" runat="server" OnClick="lbtnMemberRegister_Click">Register</asp:LinkButton>
</td>
</tr>
</table>
</div>
Here's my css
#loginpage
{
position:absolute;
margin-top:-15%;
overflow:hidden;
}
I used overflow:auto as well but it still the same. I attempted to change my position to relative but it doesn't work as well. I've added the margin-top:-15%; so as to align my login just slightly below my header without the mobile keyboard. But with the keyboard, it would look like the image i posted above. Therefore, i need to fix my element in it's original position.
Does anyone have any idea on how to solve this problem?
How do I prevent a table from wrapping when it is inside of an outer table cell?
Have a look at the simplified example at the bottom of my question.
My aspx-tablerow:
<tr runat="server" id="trButtons">
<td align="left" colspan="9" valign="top" style="white-space:nowrap"><br />
<asp:Button ID="btnImeiLookup" OnClick="btnImeiLookupClick" runat="server" ValidationGroup="VG_RMA_LOOKUP" CausesValidation="true" Text="lookup IMEI" ToolTip="lookup IMEI and check if RMA-Number can be generated" Width="120px" />
<asp:Button ID="BtnEdit" CommandName="Edit" CommandArgument='<%# Eval("idRMA")%>' ValidationGroup="VG_RMA_SAVE" runat="server" CausesValidation="false" Text="Edit" ToolTip="edit" Width="120px" />
<asp:Button ID="BtnAdd" runat="server" CommandName="Add" CausesValidation="false" Text="Add new" Width="130px" ToolTip="add new" />
<asp:Button ID="BtnDelete" runat="server" CommandName="Delete" CommandArgument='<%# Eval("idRMA")%>' CausesValidation="true" Text="Delete" Width="120px" ToolTip="delete" OnClientClick="return confirm('do you really want to delete this RMA?')" />
<uc4:RmaPrinterView ID="RmaPrinterView1" Visible="true" runat="server" />
</td>
</tr>
RmaPrinterView1 is an ASP.Net Usercontrol:
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="button" style="width:120px; white-space:nowrap" onclick="javascript:$('#TblPrinterView').jqprint();" value="Print" title="Print" />
</td>
</tr>
<tr>
<td>
<table id="TblPrinterView" style="display:none">
<tr>
<td style="width:100px;white-space:nowrap">
<asp:Label ID="LblRmaNumberDesc" runat="server" Text="RMA-Number:"></asp:Label>
</td>
<td>
<asp:Label ID="LblRmaNumber" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblImeiDesc" runat="server" Text="IMEI:"></asp:Label>
</td>
<td>
<asp:Label ID="LblImei" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblModelDesc" runat="server" Text="Model:"></asp:Label>
</td>
<td>
<asp:Label ID="LblModel" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblSiDpyDesc" runat="server" Text="SI/DPY:"></asp:Label>
</td>
<td>
<asp:Label ID="LblSiDpy" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblSymptomCodesDesc" runat="server" Text="Symptoms:"></asp:Label>
</td>
<td>
<asp:Label ID="LblSymptomCodes" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
As you can see, the Usercontrol with the inner table is wrapped:
I know that I should avoid table layout, but I needed a fast working solution ;-)
EDIT: a simplified sample that is also wrapping:
<table>
<tr>
<td style="white-space:nowrap">
<input type="button" value="b1" />
<input type="button" value="b2" />
<input type="button" value="b3" />
<table>
<tr>
<td style="white-space:nowrap"><input type="button" value="in table" /></td>
</tr>
</table>
</td>
</tr>
</table>
UPDATE:
The solution - as Jeroen mentioned - was to make the table an inline element with style="display: inline". The next problem was that I used an ASP.Net UpdatePanel inside the UserControl which is normally rendered as a Div. So the next block-element that causes my table to wrap. I only needed to set the UpdatePanel's RenderMode to Inline what causes it to be rendered as Span.
If the css white-space does not work, you can try to add nowrap="nowrap" to your td, just like you added valign="top".
Very ugly, but it should work.
Edit: Ah, now I see: A table is a block-level element so it will always go to a new line unless you make it an inline-element or float it.
table tr td {
white-space: nowrap;
}
You've put the table at odds with itself. It is set to finite pixel count and yet you don't want to wrap once that's exceeded. You might attempt:
white-space: nowrap;
overflow: hidden;