Last post Feb 02, 2009 11:17 PM by nilsan
Feb 01, 2009 07:26 AM|clarkeyb0y1987|LINK
I am currently writing a website for a company to display their products to their customers. One of the things I am putting into it is the ability to add news items onto the homepage, only part of the admin side of the site.
I have managed to extract some news items from the database, and display them dynamically in a Web User Control which I have added to Default.aspx. I have managed to add buttons for "Update" with events. The problem is that, on clicking one of these update
buttons, the page reloads with the theme applied (as it should), but the css files from the theme do not apply - the body text is bigger than it should be and changes back to the default font. I know the skin files apply as I have tried setting all button
backgrounds to black by default. The css files seem to apply to any text which is generated from clicking an update button (I have it so it writes the title of the news item for the button that was clicked. This text is the size and font it should be). I have
spent HOURS trying to work out why this is happening, with loads of Googling but no success. It is almost as if the theme is being applied between the PageLoad event and the ButtonClick event, but the skin files would say otherwise. Does anyone know why this
If it helps, I am setting the theme in the @Pages directive in the web.config file. I am also setting the master page here which seems to be loading fine.
Here is the code for the relevant parts.
3 'Inside the Init event
4 btnUpdate = New Button()
5 btnUpdate.ID = "update" & ni.ID
6 btnUpdate.Text = "Update"
7 AddHandler btnUpdate.Click,
9 'Inside the btnUpdate_Click event
11 Dim btnSrc As Button =
12 For i As Integer = 0
To Limit - 1
13 Dim ni As NewsItem = nis(i)
14 If btnSrc.ID = "update" & ni.ID
15 Response.Write("News Item: " & ni.Title)
16 End If
18 Catch ex As Exception
19 End Try
Any help would be appreciated.
Feb 01, 2009 08:59 AM|nilsan|LINK
I have managed to add buttons for "Update" with events. The problem is that, on clicking one of these update buttons, the page reloads with the theme applied (as it should), but the css files from the theme do not apply - the body text is bigger than it should
be and changes back to the default font.
I don't think that addhandler could cause any problem in applying theme on your page.. and i am not getting what exactly is the issue..styles are applied or not..[:O]
Feb 01, 2009 09:05 AM|clarkeyb0y1987|LINK
I basically have multiple update buttons - one generated for every news item being displayed. These buttons have events added to them (in the code behind, when they are created in the Init event). When the page first loads, the theme and css styles are applied
fine. The body text is the correct size and font.
I then try clicking an update button which, for testing purposed, prints the title to the page. However, when the event is fired, the whole page has the theme applied but not the css styles. The theme (skins) is applied to the whole page, but the css styles
are only applied to the text printed as a result of clicking the button. Css styles are not applied to the rest of the page, even though they should be as the skins are applied to the whole page.
Feb 01, 2009 10:00 AM|nilsan|LINK
Please check out whether you added reference of css in your page..and one more thing you can do it
download the firebug plugin for firefox and check out the CSS styles when the page reloads next time..
it will show you the styles and rendered page..
and one more thing you can do is that you can add css dynamically for your page in button click event..
Feb 01, 2009 10:14 AM|clarkeyb0y1987|LINK
Just discovered what it is - its not a problem with the code ([:D]) - its a browser based thing. It displays perfectly in Firefox, before and after clicking an update button. Its IE that is the problem. I have tried explicitly putting <link rel=...> etc
in the page head.. and it still doesnt work in IE. Good idea looking at it with Firefox, thanks Nilsan.. I shouldve remembered that because I do "quality control" for the local council, checking thru the pages using Firefox with Web Developer there..
Feb 01, 2009 12:07 PM|nilsan|LINK
Ok which version of IE are you using? you can explicitly define styles for IE in your CSS...you can call it IE Hack ;)
and if you have solved your problem then mark the post as resolved..
Feb 02, 2009 02:23 PM|clarkeyb0y1987|LINK
Seems this issue has resolved itself - I remade the sections that seemed to be playing up so they are now a lot more logical.. works fine now.
I basically had a module called newsmanager, newslist which was an instance within newsmanager and this stored all of the newitems as instances of class newsitem. These stored their details but no components. In the user control, I rewrote the code so that
there was a class called CustomNewsItem with events for itemupdated and itemdelete which either updated the details being displayed on the labels within the class or set the table the details were displayed in to invisible. Since I did all this its been working
Feb 02, 2009 11:17 PM|nilsan|LINK
I am happy that your issue has resolved now..please mark the post as resolved..so others don't try to respond this thread..
Happy programming.. [:)]