Archive

Posts Tagged ‘ASP.net’

HowTo: Perform ASP.net action after page child controls are databound

While creating metadata entry/update pages for ClipFlair’s Activity and Clip Galleries I had the problem of figuring out how to do some initialization (from XML data, loaded from a filename based on the 1st item of a DataBound control), after all child controls of the ASP.net Page have been databound (from XmlDataSource).

Seems others have asked about that too, so I contributed my solution:

http://stackoverflow.com/questions/3499175/asp-net-perform-action-after-child-controls-databound-complete/17588449#17588449

Based on ASP.net Page Life Cycle Events article I used:

protected void Page_PreRenderComplete(object sender, EventArgs e)
{
  if (!IsPostBack) //only at 1st load
    UpdateSelection();
}

protected void UpdateSelection()
{
  UpdateSelection(listItems.SelectedValue);
}

protected void listItems_SelectedIndexChanged(object sender, EventArgs e)
{
  UpdateSelection();
}

where UpdateSelection was loading XML data from a file selected at a dropdown list (which at start is pointing to index 0) and needed some CheckBoxLists on the page to have first gotten their items from other XML files so that they would allow the code to check items on them based on the XML data (from then on UpdateSelection is just getting called at the dropdownlist SelectedIndexChanged event – those do PostBacks so at PreRenderComplete we ignore them to avoid doing UpdateSelection twice)

Advertisements

ASP.net WebPartZone skins and CSS

I was just examining a MonoX portal skin that our designer is authoring for the ClipFlair platform and noticed that in the Default.skin file, there’s a note pointing to http://support.microsoft.com/kb/911717 that speaks of an issue with Microsoft’s implementation of WebPartZone skins:

There it says:

The CssClass property does not affect the following style objects:

•The MenuLabelHoverStyle property
•The MenuPopupStyle property
•The MenuVerbHoverStyle property
•The MenuVerbStyle property
•The MenuCheckImageStyle property

Do not use the following line of code:

<MenuPopupStyle CssClass="wp_menupopup" />

while having a Stylesheet.css file with the following code:

.wp_menupopup
{
  background-color:Red  
}

Instead, use the following line of code:

<MenuPopupStyle backcolor="red" />

In short, at the Default.skin file one can give a CssClass and then define the styles at Stylesheet.css, but for MenuPopupStyle, MenuVerbHoverStyle, MenuVerbStyle and MenuCheckImageStyle this doesn’t work and you have to enter the object properties that correspond to the CSS attributes you want (e.g. background property of ASP.net for the background-color CSS attribute) directly into the Default.skin file for the respective objects.

BTW, the aformentioned Microsoft article speaks of Stylesheet.css, while MonoX template uses Default.css. This is because the ASP.net theming engine applies all .css files it finds in the theme folder (independent of filename), as explained at http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx. That last Microsoft article has lots of useful information regarding Themes and how you can (optionally) combine them with CSS and on issues like scoping, precedence, security etc.

Converting a VB6 form to an ASP.net WebForm

See my opensource VB6toWebForm tool at http://github.com/zoomicon/tranXform

It converts a VB6 form’s design to XML (eXtended Markup Language) via my VB6FormDesignToXML tool that you can also find on that site, and then via XSL (eXtended Stylesheet Transformations) it converts that XML into ASP.net 1.x WebForm pages (using classic vertical flow layout based on the tab-order from the VB6 form and making sure labels that have been assigned to edit controls stay on the same line as those controls)

If you use ASP.net 2.x, VS.net has a nice import wizard (which won’t convert the coding style of those 1.x pages [e.g. the usage of a single codebehind file without using a partial class – a concept that .NET1.x didn’t support], but will tweak them to work fine with ASP.net 2.x)

If you add to the XSL transformations files logic to handle more VB6 controls, please consider contributing your enhancements to the tranXform project

BTW, more free XML related utilities are on that website

 

UPDATE

if you get a transformation error, please open up WebForm.xsl in XSL subfolder and replace | with or (with small letters). Seems MSXML engine stopped supporting | in test expressions and needs or instead. However, better download the latest version from http://github.com/zoomicon/tranXform that now also supports MDI forms etc.

Categories: Posts Tags:

web.config’s schema change at .NET2: node doesn’t define child node anymore

At an ASP.net project I was moving from ASP.net 1 to ASP.net 2, at "web.config" file of the web application I had to move <compilers> child node of <configuration>/<system.web>/<compilation> node to a new <configuration>/<system.codedom> node.

The former one has been deprected at .NET2 (although still supported and overriding the <system.codedom>’s <compilers> setting if existing) and the Web.config XML editor was compilaing that the schema didn’t define a <compilers> child for <configuration>/<system.web>/<compilation> node.

Categories: Uncategorized Tags:
%d bloggers like this: