Hi!
I add some web user controls dynamicly with:
myPanel.Control s.Add(Page.Load Control("MyDyna miclyAddedPage. ascx"));
the style of the controls on the user control is set from a css-class, by
setting the CssClass-property, but they doesn't display properly.
If the user control is added at design time everything looks correct.
Any ideas?
Thanks!
/Henke 5 2561
When you add a user control, the control ID may change. If you're using
this ID in any of the styling, then the style will no longer work correctly.
E.g.
<style>
#MyDiv .foo
{
color: #ff2200;
}
</style>
<div id="MyDiv" runat="server" CssClass="foo"> This is some text</div>
This will work correctly if added directly at design time. However, if you
put this into a user control, the ID will be changed to something like
"MyUserControl_ MyDiv". This will cause the style to stop working, as the
style will only be applied to tags with the ID of "MyDiv".
This might not be your case, but if you can post the style(s) not working,
and a snippet of your code, we can check :-)
Hope this helps,
Mun
"Henke" <he********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Hi!
I add some web user controls dynamicly with:
myPanel.Control s.Add(Page.Load Control("MyDyna miclyAddedPage. ascx")); the style of the controls on the user control is set from a css-class, by setting the CssClass-property, but they doesn't display properly.
If the user control is added at design time everything looks correct.
Any ideas? Thanks! /Henke
Hi, and thaks for your quick answer.
I should say I'm not that used to work with css-files but this is how it
looks:
In my css-file:
..Label
{
font-size: 10pt;
font-family: 'Arial Narrow';
}
And than I just set the CssClass property on all my labels on the user
control to Label.
This is how one label looks in "HTML-file" at design time:
<asp:label id="Label8" style="Z-INDEX: 104; LEFT: 8px; POSITION: absolute;
TOP: 24px" runat="server" CssClass="Label ">Name *</asp:label>
An this is how the source looks when the page is displayed in a browser:
<span id="dynamicCont rolHost__ctl0_L abel8" class="Label" style="Z-INDEX:
104; LEFT: 8px; POSITION: absolute; TOP: 24px">Name *</span>
/Henke
"Munsifali Rashid" <mun@**RemoveTo Reply**vefuk.co m> skrev i meddelandet
news:e4******** *****@TK2MSFTNG P09.phx.gbl... When you add a user control, the control ID may change. If you're using this ID in any of the styling, then the style will no longer work
correctly. E.g.
<style> #MyDiv .foo { color: #ff2200; } </style>
<div id="MyDiv" runat="server" CssClass="foo"> This is some text</div>
This will work correctly if added directly at design time. However, if
you put this into a user control, the ID will be changed to something like "MyUserControl_ MyDiv". This will cause the style to stop working, as the style will only be applied to tags with the ID of "MyDiv".
This might not be your case, but if you can post the style(s) not working, and a snippet of your code, we can check :-)
Hope this helps,
Mun "Henke" <he********@hot mail.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Hi!
I add some web user controls dynamicly with:
myPanel.Control s.Add(Page.Load Control("MyDyna miclyAddedPage. ascx")); the style of the controls on the user control is set from a css-class,
by setting the CssClass-property, but they doesn't display properly.
If the user control is added at design time everything looks correct.
Any ideas? Thanks! /Henke
There doesn't appear to be anything obviously wrong with the code below.
I'm not sure that 'Arial Narrow' should be in single quotes though - it
should work fine without. However, that wouldn't explain why it works
correctly at design time, but not as a user control.
When you said it doesn't display correctly, what exactly happens? Is the
font incorrect (eg. it appears too big, or is the wrong typeface), or is the
style tag being ignored (eg. the user control is not obeying the absolute
positioning and is not being displayed on the correct part of the page) ?
Regards,
Mun
"Henke" <he********@hot mail.com> wrote in message
news:u1******** ******@TK2MSFTN GP10.phx.gbl... Hi, and thaks for your quick answer. I should say I'm not that used to work with css-files but this is how it looks: In my css-file: .Label { font-size: 10pt; font-family: 'Arial Narrow'; }
And than I just set the CssClass property on all my labels on the user control to Label.
This is how one label looks in "HTML-file" at design time: <asp:label id="Label8" style="Z-INDEX: 104; LEFT: 8px; POSITION: absolute; TOP: 24px" runat="server" CssClass="Label ">Name *</asp:label>
An this is how the source looks when the page is displayed in a browser: <span id="dynamicCont rolHost__ctl0_L abel8" class="Label" style="Z-INDEX: 104; LEFT: 8px; POSITION: absolute; TOP: 24px">Name *</span>
/Henke
Both font-size and font-family is incorrect. But I noticed something else,
some user controls get correctly displayed the first time they ar shown, but
the second time the gets displayed the fonts are wrong.
Does it matter if I put my user controls on panels or in place holders?
Now I have a panel on which I loads new user controls depending on some menu
selections.
/Henke
"Munsifali Rashid" <mun.news@#Remo veToReply#cordl essmouse.co.uk> skrev i
meddelandet news:OH******** ******@TK2MSFTN GP09.phx.gbl... There doesn't appear to be anything obviously wrong with the code below. I'm not sure that 'Arial Narrow' should be in single quotes though - it should work fine without. However, that wouldn't explain why it works correctly at design time, but not as a user control.
When you said it doesn't display correctly, what exactly happens? Is the font incorrect (eg. it appears too big, or is the wrong typeface), or is
the style tag being ignored (eg. the user control is not obeying the absolute positioning and is not being displayed on the correct part of the page) ?
Regards,
Mun
"Henke" <he********@hot mail.com> wrote in message news:u1******** ******@TK2MSFTN GP10.phx.gbl... Hi, and thaks for your quick answer. I should say I'm not that used to work with css-files but this is how it looks: In my css-file: .Label { font-size: 10pt; font-family: 'Arial Narrow'; }
And than I just set the CssClass property on all my labels on the user control to Label.
This is how one label looks in "HTML-file" at design time: <asp:label id="Label8" style="Z-INDEX: 104; LEFT: 8px; POSITION:
absolute; TOP: 24px" runat="server" CssClass="Label ">Name *</asp:label>
An this is how the source looks when the page is displayed in a browser: <span id="dynamicCont rolHost__ctl0_L abel8" class="Label" style="Z-INDEX: 104; LEFT: 8px; POSITION: absolute; TOP: 24px">Name *</span>
/Henke
It shouldn't matter whether your controls are in panels or placeholders.
I've used both in the past, with CSS styling without any problems. Netscape
does some weird things with stylesheets sometimes, but I'm assuming that
you're using Internet Explorer, which shouldn't be a problem.
Mun
"Henke" <he********@hot mail.com> wrote in message
news:O6******** ******@TK2MSFTN GP09.phx.gbl... Both font-size and font-family is incorrect. But I noticed something else, some user controls get correctly displayed the first time they ar shown,
but the second time the gets displayed the fonts are wrong. Does it matter if I put my user controls on panels or in place holders? Now I have a panel on which I loads new user controls depending on some
menu selections.
/Henke
"Munsifali Rashid" <mun.news@#Remo veToReply#cordl essmouse.co.uk> skrev i meddelandet news:OH******** ******@TK2MSFTN GP09.phx.gbl... There doesn't appear to be anything obviously wrong with the code below. I'm not sure that 'Arial Narrow' should be in single quotes though - it should work fine without. However, that wouldn't explain why it works correctly at design time, but not as a user control.
When you said it doesn't display correctly, what exactly happens? Is
the font incorrect (eg. it appears too big, or is the wrong typeface), or is the style tag being ignored (eg. the user control is not obeying the
absolute positioning and is not being displayed on the correct part of the page)
? Regards,
Mun This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Henke |
last post by:
I added a project to my solution that contains a user control. Now I 'd like
to add the user control from that project to a form in my solution. The
problem is that the control doesn't gets added to the My User Control tab.
Any ideas?
Thanks in advance, Henke!
|
by: babylon |
last post by:
I created a class which inherits from UserControl..
However, I can't find it in the "My User Controls" tab in designer view...
How can i add it back myself?
thx...
|
by: Cy Huckaba |
last post by:
We are running our company website on a win2k server running .NET framework 1.0
and IIS 5. The pages consist of mostly static content built from a combination
of custom controls (dll is only 148k total), user controls and straight html
content. I am very strict about only using server-side controls when absolutely
necessary.
I have output caching turned on every page and user control; we do not hit any
databases; a couple of pages use...
|
by: Henke |
last post by:
Hi
I have a aspx-page with a panel-control. On this panel control I add user
controls dynamicly with LoadControl and panel.Controls.Add(myControl).
On some of the dynamicly added user controls I have button's and handlers
for the click event.
Why doesn't the event get fired in the dynamicly added control?
Thanks!
|
by: DaWoE |
last post by:
Hi all,
I'm fairly new to ASP.NET. What i want to do is creat a online
registration form. On the first step is getting the users details and
the number of people he wants to register.
Based on the number of people i want to create a form where he can enter
the persons details.
For example he wants to register 3 people. Then the second step of the
registration would have to be like this :
| |
by: Bennett Haselton |
last post by:
I create a new Web Form and drag a new Button onto it from the Web
Forms toolbox tab, and then I drag a new instance of the UserPost user
control that I created, by dragging and dropping the "UserPost.ascx"
file listing from Solution Explorer. Both controls show up on the Web
Form. But when I switch to the codebehind page, there is only a
declaration for Button1:
protected System.Web.UI.WebControls.Button Button1;
and not one for...
|
by: Anders K. Jacobsen [DK] |
last post by:
Hi im creating a (or is starting but need your advise) search page for some
products which has surdden charataristicas which all should be serachable.
These charataristicas can be added runtime so to say and the charataristicas
is stored in the database where they are decribed eg. The charataristicas is
a Textbox, width=20 and so on.
Therefore I need to dynamically add controls to my search page according to
the database. But how will...
|
by: GS |
last post by:
Hi,
I dynamicly add custom control in SelectedIndexChanged even of GridView which is firing after Page_Load. My control is not being rendered to page becouse of that (I assume). How to avoid this situation? Sample below
protected void dgrCompanies_SelectedIndexChanged(object sender, EventArgs e)
{
GoogleControl MyGoogleControl = new GoogleControl ();
PlaceHolderForMap.Controls.Add(MyGoogleControl);
}
|
by: Johnny Jörgensen |
last post by:
I've got a usercontrol derived from a normal ComboBox that contains some
special formatting code. On my main form I've got a lot of my custom
comboboxes.
I discovered a bug in the derived control and fixed it. But it still doesn't
work for the controls already added to the form. It works fine for new
instances of the control dragged from the toolbox to the form.
I don't want to have to drag and drop new controls to exchange all my old...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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();...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |