Applying CSS to a textbox within a formview control?

I would suggest you to assign css directly, as server side control ID renders in complete hierarchy with catenation. Like in your case, there will Content Place Holderand and Textbox (ctl00_ContentPlaceHolder_txtapplicantfname) If there will any more panel Tab Panel(ctl00_ContentPlaceHolder_TabPanelID_txtapplicantfname) etc involve hierarchy will be disturbed You can do like asp:TextBox ID="txtapplicantfname" CssClass="txtapplicantfname" runat="server" Text=''> . Txtapplicantfname { width: 70px; border-bottom: 1px solid #0954A5; border-left-style: none; border-left-color: inherit; border-left-width: 0; border-right-style: none; border-right-color: inherit; border-right-width: 0; border-top-style: none; border-top-color: inherit; border-top-width: 0; font-size: 10px; }.

I would suggest you to assign css directly, as server side control ID renders in complete hierarchy with catenation. Like in your case, there will Content Place Holderand and Textbox (ctl00_ContentPlaceHolder_txtapplicantfname). If there will any more panel, Tab Panel(ctl00_ContentPlaceHolder_TabPanelID_txtapplicantfname), etc involve hierarchy will be disturbed.

You can do like... '> . Txtapplicantfname { width: 70px; border-bottom: 1px solid #0954A5; border-left-style: none; border-left-color: inherit; border-left-width: 0; border-right-style: none; border-right-color: inherit; border-right-width: 0; border-top-style: none; border-top-color: inherit; border-top-width: 0; font-size: 10px; }.

1 very true indeed. – naveen May 29 at 7:37 I am sorry that will not work for me as I have applied a standard textbox class to all textboxes. What if I was to put a table within the form would it see my css styles then?

– Jawaid Akhtar May 30 at 1:25 But you want to assign specific class to TxtApplicationFname, and it should work if you assign specific class. That is answer. – Muhammad Akhtar May 30 at 4:01 Thanks I am re designing the form to use all class I was just under the impression you only use classes for css when you are going to have multiple controls with the same styles.

Thanks for all your help – Jawaid Akhtar May 30 at 14:45.

You know that when you use ASP. NET server controls, they are converted to HTML tags. The TextBox control will be rendered in HTML as an "input" tag.In the process however, ASP.

NET does not give the same ID to the HTML tag. It will not be "txtapplicantfname", it will be something like "ctl00_ContentPlaceHolder_txtapplicantfname". CSS styles apply to the HTML tags, not the ASP.

NET code. So in the CSS stylesheet, if you refer to a control ID, you need to refer to the ID of the rendered HTML code. Your style should be: #ctl00_ContentPlaceHolder_txtapplicantfname { (...) Just display your page in a navigator (or execute in debug mode) and check the source to get the real IDs for the HTML tags.

1 sorry. Very wrong approach. Especially when ASP.NET has these ClientIDMode and all.

CssClass is there for a reason – naveen May 29 at 7:36 Sorry I tried to run the form in debug mode however I can not find where it shows the full path to the id of the controls. – Jawaid Akhtar May 30 at 1:26.

Additionally, Within asp. Net form you can use # { (...) }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions