Adjust ASP button element font size - asp.net

How can I implement a font-resize feature that also adjusts the text size of all ASP elements?
I'm part of a team that is working to implement an interactive course catalogue as a class project. The typical user for the site will be > 50, and one common request from surveys an interviews was to have a user-adjustable test size increase/decrease of not only the on-screen text, but the buttons, lists and other elements.
Another requirement for this class: everything has to be implemented in ASP.NET & C# 4.0.
According to the documentation, the object FontUnit controls the size and type style of ASP elements. We're going to be using a number of elements nested inside HTML divs, and would like some way for a single button click to implement a page-wide text size increase/decrease.
I tried
btnTextSize.Font.Size= FontUnit.Larger;
to test on a couple elements, but there was no change in size.

Try this:
http://www.white-hat-web-design.co.uk/blog/controlling-font-size-with-javascript/
It's javascript, but it may work for your needs.

Related

Designing Custom Drop Down with mulitple rows and columns

I have a requirement like for the drop down as shown. Could any one help me in achieving this.
Briefing:
On click of the button a pane should be opened which contains rows and columns containing text, on click of it appropriate action need to take place. The source can be dynamic too....
There are many techniques for acheiving this design. You could do it purely with html and css by having an image that looks like a dropdown popup an absolutely positioned div underneath. Or you could use the asp.net ajax control toolkit control called "PopupControl" that essentially abstracts all the html/css away allowing you to just specify a target panel. There are also various jquery plugins, here is one from abeatifulsite.

Asp.net treview image padding

I have a treeview that I am creating dynamically from xml (via a web service) and I have it populating and formatting mostly the way I want. However, the one thing that I'm still having some difficulty with is being able to manipulate some of the items within each element of the treeview. Sepcifically, each of the image that I'm using to represent the various node levels. From the source it looks like it's just an image tag in an a tag, which in turn is within at td. However none of these have classes associated with them. Is there a standard way of manipulating spacing or formatting within each node of a treeview? Searching hasn't been very successful but maybe I'm not looking for the right thing...
Since you've noticed the hideous markup that some of the ASP.NET server controls produce, check out the CSS Friendly Control Adapters. Rather than writing out nested tables, the control adapters will render markup that is much easier to work with.
Here is a sample output from a TreeView control. The li elements have classes which you can use when styling their child elements.

ASP.Net container control with multiple control collections

I've been trying to create a special kind of fieldset. Which does all kind of fantastic things, but mainly collapse and maintain state. Also the two parts of the fieldset (in the legend, and in the rest) must be available to code behind (declaratively).
The code in the consuming page or control should look something like this:
<myTagPrefix:Fieldset>
<myTagPrefix:Legend>[controls here should be available in codebehind]</myTagPrefix:Legend>
<myTagPrefix:Content>[controls here should be available in codebehind]</myTagPrefix:Content>
</myTagPrefix:Fieldset>
Or
<myTagPrefix:Fieldset>
<Legend>[controls here should be available in codebehind]</Legend>
<Content>[controls here should be available in codebehind]</Content>
</myTagPrefix:Fieldset>
Which would produce more-or-less the following HTML (excluding the magic collapsing and state-maintaining code):
<fieldset>
<legend>[result of rendered legend controls]</legend>
[result of rendered legend controls]
</fieldset>
I've looked into a templated control, exposing template container via properties marked as 'TemplateContainer', which works nice, except for the fact that the code behind cannot access the controls in the template anymore.
I also looked into inheriting a container control like panel, and override the render methods for the begin- and end-tag, which is also nice, except for that it can contain only one control collection, while this fieldset control should have two (the controls in the legend and the controls in the rest fieldset). This could be overcome by exposing the text of the legend as a property of the fieldset, but to keep things complicated, text is not the only thing to be displayed in the legend. (for instance: images and buttons can be displayed too).
This question can be seen more abstractly of course, I'm basically asking for a container control with multiple child control collections.
When I tried to figure out what to compare this with, the functionality comes close to a MultiView; a MultiView can only contain controls of Type 'View', and the controls of a View are available in code-behind. The fact that a MultiView does not restrict the number and uniqueness of its childcontrols, and my control should (a maximum of one legend, and one content element) is something I could live with ... for now ;)
Does anyone have an idea how the MultiView was built? Is there a trick I'm overlooking? Any help or suggestion would be appreciated.

Flex advanced datagrid styling

I'm using an advanced datagrid in a system I'm building.
the design PSD from the designer includes a special background on rollover.
So, I need the background of the cells in a row to get the background from an image, only when the mouse rolls over a specific row.
is this even possible?
can a row get the background from an image (CSS)
There is a method available in DataGrids (and Lists) called drawRowBackgrounds() that is responsible for drawing a simple highlight into a row in response to a user interaction. You might be able to accomplish the design in the PSD programmatically by using the Flash drawing API. If you need to use an image asset, you could try to add it as a child of the Sprite that is passed as the first argument of this method call.

Automatically mark ASP.Net controls which have a RequiredFieldValidator on them

Is there a clean and centralized way to automatically designate a background color or other CSS property for ASP.Net controls (i.e. a TextBox) with an enabled RequiredFieldValidator?
Currently I have manually set the background color of required controls to yellow. I would like to replace that with a central method so if the client requests a different color or marker or if a field's status changes from required to not or vice versa, I won't miss any of the controls.
Thanks
Update
This site is pre-compiled. Can something append a Css Class or other standards-compliant flag to items in the ControlToValidtate property at compile time?
Why not add a css class of required. You can have multiple classes on a single control by space delimiting them so imagine an input field which takes a number:
Now I can have two classes one which right aligns the text and one which handles the required field requirements.
Edit
One option before the page is rendered to walk through each control in the page, and if it's a required field validator, then find it's corresponding control and set the css property; however, this is a lot of work for somethign which you can tackle at design time.

Resources