Access Text From CSS Textbox - c#

I am using the below html & css to create and align textboxes. It does the job perfectly, but anytime I Try to access the text from my C# code behind by using txtfield1.Text I get a compile error of txtfield1 does not exist in the current context.
This is my css
.left
{
padding:2px;
width: 30%;
float: left;
text-align: right;
}
.right
{
padding:2px;
width: 60%;
margin-left: 10px;
float:left;
}
.text1
{
width: 70px;
}
.text2
{
width: 150px;
}
and this is my html markup
<div>
<div class="left">Option One:</div>
<div class="right"><input class="txtfield1" type="text" runat="server"/></div>
</div>
<div>
<div class="left">Option Two:</div>
<div class="right"><input class="text2" type="text" runat="server"/></div>
</div>
<div>
<div class="left">Option Three:</div>
<div class="right"><input class="text2" type="text" runat="server"/></div>
</div>

See your html carefully.
<div class="right"><input class="txtfield1" id="txtfieldid1" type="text" runat="server"/></div>
You need to assign an id then you can access the variable at c# code behind
txtfieldid1.text
You are not using txtfield1.That's why you get compile error.

Related

How can i make the size of the div standard whilst changing the elements inside it to accommodate the div?

I want to make the div a standard size of 330px. But when I do it, the elements in the div will get screwed up.
<div class="col-md-3 m-wthree" style="height:330px;">
<div class="col-m">
<a href="#" data-toggle="modal" data-target="##item.id" class="offer-img">
<img src="#item.productImage" class="img-responsive" alt="" style="width:auto;height:124px;">
<div class="offer"><p><span>Offer</span></p></div>
</a>
<div class="mid-1">
<div class="women">
<h6>#item.productName</h6>
</div>
<div class="mid-2">
<p><label>$#item.productOriginalPrice</label><em class="item_price">$#item.productCurrentPrice</em></p>
<div class="clearfix"></div>
</div>
<div class="add">
<button class="btn btn-danger my-cart-btn my-cart-b " data-id="#item.id" data-name="#item.productName" data-summary="#item.productName" data-price="#item.productCurrentPrice" data-quantity="1" data-image="#item.productImage">Add to Cart</button>
</div>
</div>
</div>
</div>
Problem
With % as height
.m-wthree {
width: 50%;
float: left;
margin-bottom: 2em;
}
.add{
text-align:center;
}
.mid-2 p{
float:left;
font-size:0.9em;
color:#B4B4B4;
}
.mid-2 p em{
font-style:normal;
}
.mid-2 p label{
text-decoration: line-through;
font-weight:400;
margin-right:6px;
}
.mid-2 {
padding: 1em 0;
}
Above is the CSS code for the custom CSS. The CSS all seem ok and does not look like it is affecting anything....

Link not taking up full div

I have a linkbutton that should show:
Register >
I tried to solve this by putting 2 divs floated into a parent div. Adding 2 linkbuttons inside one with Register as text and one with > as text.
I then added a css class to have the a tag take up the full div. For the register part this works perfectly, for the > part this does not work at all.
Any suggestions?
Tried to replace > with text to see what that does, but also no solution there, the > character doesn't seem to be the problem
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" />
.eventWebsite {
/*padding:10px 10px;*/
font-weight: bold;
background-color: #ffc903;
align-items: center;
}
.eventWebsite a {
color: inherit;
}
.eventArrow {
color: #000;
}
.link_class2 {
display: inline-block;
width: 100%;
height: 100%;
padding: 6% 8%;
}
<div class="row noMargin col-12 pl0 pr0 eventWebsite">
<div class="col-10 pl0">
<a id="cntModal_hypEventWebsite" class="link_class2" href="https://www.eventbrite.co.uk/e/new-crestron-cpd-transforming-design-with-light-tickets-55068781207">Event website</a>
</div>
<div class="col-2 EventArrow" style="text-align:right;">
<a id="cntModal_hypEventWebsiteArrow" class="link_class2" href="https://www.eventbrite.co.uk/e/new-crestron-cpd-transforming-design-with-light-tickets-55068781207">></a>
</div>
<br style="clear:both;">
</div>

How can i apply bootstrap in my website? ASP.NET, C#

I have design a website which working fine regarding to design in desktop pc/laptop screen,but it's not working well in mobile and tablets devices.I'm using "responsive web design tester" google chorme add one to check this.It's middle contents changes.
How can i apply bootstrap in my website??I just include links of bootstrap or change the whole design.I'm beginner,I don't know how to apply "bootstrap".I have installed "Bootstrap" by using “Manage NuGet Package". Here is my solution explore snapshot
Here is my desktop view some content
Here mobile view
Here is my aspx code ,specific part of code in which the content not working well :
<section id="about">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="title-area">
<h2 class="title">About us</h2>
<span class="line"></span>
<p>
UpSkill blends scientifically approved principles of learning and the best quality content to boost personal learning!
We aim to be the hub of quality education for personal growth and individual learning for a successful career!
</p>
</div>
</div>
</div>
</div>
</section>
<!-- end about -->
<!--Courses Start Here-->
<section id="our-team">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="title-area">
<h2 class="title">Our Courses</h2>
<span class="line"></span>
<p>Search Courses as you want to study and Learn from our best Team!</p>
</div>
</div>
<div class="col-md-12">
<div class="our-team-content">
<div class="container">
<div class="row">
<!-- Start single Course -->
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="single-team-member">
<div class="team-member-img">
<img src="assets\images\courses\linux.png" alt="linux img">
</div>
<div class="team-member-name">
<p style="position: relative; left: 7px; font-size: 25px;">Introduction to Linux </p>
<span style="position:relative; left:7px">CS250</span>
</div>
<p></p>
</div>
<!-- <div class="team-member-link">
<a class="read-btn wow fadeInUp" href="#"><font color="black"></font></a>
</div> -->
</div>
<!-- Start single Course -->
<!-- Start single Course -->
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="single-team-member">
<div class="team-member-img">
<img src="assets\images\courses\asp-net.png" alt="asp.net img">
</div>
<div class="team-member-name">
<p style="position: relative; left: 7px; font-size: 25px;">Introduction to Asp.net</p>
<span style="position:relative; left:7px">CS250</span>
</div>
<p></p>
</div>
<!--<div class="team-member-link">
<a class="read-btn wow fadeInUp" href="#"><font color="black"></font></a>
</div>-->
</div>
<!-- Start single Course -->
<!-- Start single Course -->
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="single-team-member">
<div class="team-member-img">
<img src="assets\images\courses\php.png" alt="php img">
</div>
<div class="team-member-name">
<p style="position: relative; left: 7px; font-size: 25px;">Introduction to PHP</p>
<span style="position:relative; left:7px">CS250</span>
</div>
<p></p>
</div>
<!--<div class="team-member-link">
<a class="read-btn wow fadeInUp" href="#"><font color="black"></font></a>
</div> -->
</div>
<!-- Start single Course -->
<!-- Start single Course -->
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="single-team-member">
<div class="team-member-img">
<img src="assets\images\courses\html.png" alt="html img">
</div>
<div class="team-member-name">
<p style="position: relative; left: 7px; font-size: 25px;">Introduction to HTML5</p>
<span style="position:relative; left:7px">CS250</span>
</div>
<p></p>
</div>
</div>
<!-- Start single Course member -->
</div>
</div>
</div>
</div>
</div>
<br />
<button style="position:relative; left:1170px; color:black; font-size:18px; width:130px; height:60px;">See More</button>
</div>
</div>
</section>
"About" and "Our Courses" also working well in mobile devices,but problem with blow code.
Here is my bootstrap.css code :
.container {
padding-right: .9375rem;
padding-left: .9375rem;
margin-right: auto;
margin-left: auto;
}
.container::after {
display: table;
clear: both;
content: "";
}
#media (min-width: 544px) {
.container {
max-width: 576px;
}
}
#media (min-width: 768px) {
.container {
max-width: 720px;
}
}
#media (min-width: 992px) {
.container {
max-width: 940px;
}
}
#media (min-width: 1200px) {
.container {
max-width: 1140px;
}
}
.container-fluid {
padding-right: .9375rem;
padding-left: .9375rem;
margin-right: auto;
margin-left: auto;
}
.container-fluid::after {
display: table;
clear: both;
content: "";
}
.row {
margin-right: -.9375rem;
margin-left: -.9375rem;
}
.row::after {
display: table;
clear: both;
content: "";
}
.col-xs-1, .col-xs-2, .col-xs-3,
.col-xs-4, .col-xs-5, .col-xs-6,
.col-xs-7, .col-xs-8, .col-xs-9,
.col-xs-10, .col-xs-11, .col-xs-12,
.col-sm-1, .col-sm-2, .col-sm-3,
.col-sm-4, .col-sm-5, .col-sm-6,
.col-sm-7, .col-sm-8, .col-sm-9,
.col-sm-10, .col-sm-11, .col-sm-12,
.col-md-1, .col-md-2, .col-md-3,
.col-md-4, .col-md-5, .col-md-6,
.col-md-7, .col-md-8, .col-md-9,
.col-md-10, .col-md-11,
.col-md-12, .col-lg-1, .col-lg-2,
.col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
.col-lg-7, .col-lg-8, .col-lg-9,
.col-lg-10, .col-lg-11, .col-lg-12,
.col-xl-1, .col-xl-2, .col-xl-3,
.col-xl-4, .col-xl-5, .col-xl-6,
.col-xl-7,.col-xl-8, .col-xl-9,
.col-xl-10, .col-xl-11, .col-xl-12 {
position: relative;
min-height: 1px;
padding-right: .9375rem;
padding-left: .9375rem;
}
.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4,
.col-xs-5, .col-xs-6, .col-xs-7,
.col-xs-8, .col-xs-9,
.col-xs-10, .col-xs-11, .col-xs-12 {
float: left;
}
.col-xs-1 {
width: 8.333333%;
}
.col-xs-2 {
width: 16.666667%;
}
.col-xs-3 {
width: 25%;
}
.col-xs-4 {
width: 33.333333%;
}
.col-xs-5 {
width: 41.666667%;
}
.col-xs-6 {
width: 50%;
}
.col-xs-7 {
width: 58.333333%;
}
.col-xs-8 {
width: 66.666667%;
}
.col-xs-9 {
width: 75%;
}
.col-xs-10 {
width: 83.333333%;
}
.col-xs-11 {
width: 91.666667%;
}
.col-xs-12 {
width: 100%;
}
How can i apply "Bootstrap" on my website?Which works well in every device.
Thanks..
There's a bit more to bootstrap than just dropping the files in (So you should spend a bit of time learning the basics), but have a look at this section to get your basic html:
http://getbootstrap.com/getting-started/#template
This will link the bootstrap javascript and css. Be sure to add any of your own javascript/css as well.
Then have a look at the overview and grid system at: http://getbootstrap.com/css/
This is how you choose the structure of your site using html as JustLearning mentioned. You'll probably be just putting your images in 1 row spanned across 4 columns.
The page looks bootstrapped to me but it depends on whether you meant you want your images to turn into links or made smaller into icons as that will be a new question. Responsive design is about the page fitting into the device and your page appears to fit although the images have been resized. Plus I don't see any MVC or C# or ASP.net so this is straight forward as it looks like you just have a basic HTML5 site. Here is a good link to get you started: http://docs.asp.net/en/latest/client-side/bootstrap.html

how to put a mic symbol inside a textbox in asp .net [duplicate]

I am using bootstrap by default textbox taking full width of column and I want to put search icon at the end to textbox.
My code is like this:
<div class="container">
<div class="row">
<div class="form-group col-lg-4">
<label class="control-label">Name</label>
<input id="txtName" class="form-control input-sm" />
<span class="glyphicon glyphicon-search"></span>
</div>
<div class="col-lg-4"></div>
<div class="col-lg-4"></div>
</div>
</div>
I don't want to use input group.
Please suggest an alternate way or alternate html with css.
Here are three different ways to do it:
Here's a working Demo in Fiddle Of All Three
Validation:
You can use native bootstrap validation states (No Custom CSS!):
<div class="form-group has-feedback">
<label class="control-label" for="inputSuccess2">Name</label>
<input type="text" class="form-control" id="inputSuccess2"/>
<span class="glyphicon glyphicon-search form-control-feedback"></span>
</div>
For a full discussion, see my answer to Add a Bootstrap Glyphicon to Input Box
Input Group:
You can use the .input-group class like this:
<div class="input-group">
<input type="text" class="form-control"/>
<span class="input-group-addon">
<i class="fa fa-search"></i>
</span>
</div>
For a full discussion, see my answer to adding Twitter Bootstrap icon to Input box
Unstyled Input Group:
You can still use .input-group for positioning but just override the default styling to make the two elements appear separate.
Use a normal input group but add the class input-group-unstyled:
<div class="input-group input-group-unstyled">
<input type="text" class="form-control" />
<span class="input-group-addon">
<i class="fa fa-search"></i>
</span>
</div>
Then change the styling with the following css:
.input-group.input-group-unstyled input.form-control {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.input-group-unstyled .input-group-addon {
border-radius: 4px;
border: 0px;
background-color: transparent;
}
Also, these solutions work for any input size
Adding a class with a width of 90% to your input element and adding the following input-icon class to your span would achieve what you want I think.
.input { width: 90%; }
.input-icon {
display: inline-block;
height: 22px;
width: 22px;
line-height: 22px;
text-align: center;
color: #000;
font-size: 12px;
font-weight: bold;
margin-left: 4px;
}
EDIT
Per dan's suggestion, it would not be wise to use .input as the class name, some more specific would be advised. I was simply using .input as a generic placeholder for your css
<input type="text" name="whatever" id="funkystyling" />
Here's the CSS for the image on the left:
#funkystyling {
background: white url(/path/to/icon.png) left no-repeat;
padding-left: 17px;
}
And here's the CSS for the image on the right:
#funkystyling {
background: white url(/path/to/icon.png) right no-repeat;
padding-right: 17px;
}
I liked #KyleMit's answer on how to make an unstyled input group, but in my case, I only wanted the right side unstyled - I still wanted to use an input-group-addon on the left side and have it look like normal bootstrap. So, I did this:
css
.input-group.input-group-unstyled-right input.form-control {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.input-group-unstyled-right .input-group-addon.input-group-addon-unstyled {
border-radius: 4px;
border: 0px;
background-color: transparent;
}
html
<div class="input-group input-group-unstyled-right">
<span class="input-group-addon">
<i class="fa fa-envelope-o"></i>
</span>
<input type="text" class="form-control">
<span class="input-group-addon input-group-addon-unstyled">
<i class="fa fa-check"></i>
</span>
</div>
You can do it in pure CSS using the :after pseudo-element and getting creative with the margins.
Here's an example, using Font Awesome for the search icon:
.search-box-container input {
padding: 5px 20px 5px 5px;
}
.search-box-container:after {
content: "\f002";
font-family: FontAwesome;
margin-left: -25px;
margin-right: 25px;
}
<!-- font awesome -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="search-box-container">
<input type="text" placeholder="Search..." />
</div>

Changing bootstrap's control label width?

Bootstrap has the following CSS:
.form-horizontal .control-label {
float: left;
width: 160px;
padding-top: 5px;
text-align: right;
}
.form-horizontal .controls {
*display: inline-block;
*padding-left: 20px;
margin-left: 180px;
*margin-left: 0;
}
It makes my form look like this:
The labels are way off to the right.
Here is how I build the form:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="kez_header">
<table class="style1">
<tr>
<td>
<h4> Add Group
</h4>
</td>
<td align="right" valign="middle">
</td>
</tr>
</table>
<div id="new_group_view" class="form-horizontal">
<form class="form-horizontal" method="POST" action="/yourownpoet/web/app_dev.php/register/">
<div class="control-group">
<label class="control-label control-label-me required" for="fos_user_registration_form_email" placeholder="Email">Email:</label>
<div class="controls">
<input id="fos_user_registration_form_email" class="text-style" type="email" placeholder="Email" required="required" name="fos_user_registration_form[email]">
<div placeholder="Password" id="fos_user_registration_form_plainPassword"></div>
</div>
</div>
<div class="control-group">
<label class="control-label required" for="fos_user_registration_form_plainPassword_Enter Password: ">Enter password: </label>
<div class="controls">
<input type="password" required="required" name="fos_user_registration_form[plainPassword][Enter Password: ]" id="fos_user_registration_form_plainPassword_Enter Password: " class="text-style">
</div>
</div>
<div class="control-group">
<label class="control-label required" for="fos_user_registration_form_plainPassword_Verify Password: ">Verify password: </label>
<div class="controls">
<input type="password" required="required" name="fos_user_registration_form[plainPassword][Verify Password: ]" id="fos_user_registration_form_plainPassword_Verify Password: " class="text-style">
</div>
</div>
</form>
</div>
</div>
</asp:Content>
How can I get this normal so that the labels start more like here:
http://bootstrap.stage42.net/doc/forms
Thanks
.form-horizontal .control-label width specifies the "how far would be last character of the label text from the left side of the parent container".
.form-horizontal .controls margin-left specifies the "how far would be left border of the field from the left side of the parent container".
This is simplified explanation but should give you enough understanding to take control over your styles.
So you should adjust .form-horizontal .control-label width and .form-horizontal .controls margin-left values proportionally, to move fields and labels inside the container. Proportionally because "space" between label and field should be preserved. Here is example:
.form-horizontal .control-label {
float: left;
width: 120px; /* changed from 160px to 120px */
padding-top: 5px;
text-align: right;
}
.form-horizontal .controls {
*display: inline-block;
*padding-left: 20px;
margin-left: 140px; /* changed from 180px to 140px */
*margin-left: 0;
}

Categories