Showing posts with label own. Show all posts
Showing posts with label own. Show all posts

Saturday, March 31, 2012

Theming custom created WebParts in ASP.NET 2.0

I have created my own WebPart using code, it is not derived from a UserControl.
Inside this WebPart I create a Calendar Control and add it to the WebParts
Control collection.

Now I want to apply a theme to this Calendar that is inside my WebPart. How
do I do that? I have created a theme and added a definition for a calendar.
The theme is applied to a calendar that is not inside the WebPart, but it is
not applied to the one inside.Hi c_kimbell,

Welcome to MSDN newsgroup.
As for the custom WebPart with a Calendar inside it, is it possible that we
define a public property on the Custom webPart which represent the Theme of
the inside Calendar control? Then, we any one assign a new value for this
property, the nested calendar's Theme value will be changed accordingly.

In addition, for .NET 2.0 and VS.NET whidbey beta issues, I suggest you
also try posting in the following web forum:

http://forums.microsoft.com/msdn/

since there are some other experienced members who may have some good ideas.

Thank you,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thanks for suggesting the ASP.NET forums, I have posted there now as well.

Here are some more details on what I have tried;
1. On the webpart I have exposed the Calendar as a property with the name
FromCalendar.
2. I have added the following to the .skin file

<%@. Register Assembly="IMK.WebParts" Namespace="IMK.WebParts"
TagPrefix="IMK" %
<IMK:IMKDateWebPart runat="server">
<FromCalendar BackColor="#FFFFCC">
<SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
<TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt"
ForeColor="#FFFFCC" />
</FromCalendar>
</IMK:IMKDateWebPart
Am I on the right track?

"Steven Cheng[MSFT]" wrote:

> Hi c_kimbell,
> Welcome to MSDN newsgroup.
> As for the custom WebPart with a Calendar inside it, is it possible that we
> define a public property on the Custom webPart which represent the Theme of
> the inside Calendar control? Then, we any one assign a new value for this
> property, the nested calendar's Theme value will be changed accordingly.
> In addition, for .NET 2.0 and VS.NET whidbey beta issues, I suggest you
> also try posting in the following web forum:
> http://forums.microsoft.com/msdn/
> since there are some other experienced members who may have some good ideas.
> Thank you,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Hi c_kimbell,

Thanks for your followup.
As you mentioned that
=================

1. On the webpart I have exposed the Calendar as a property with the name
FromCalendar.
2. I have added the following to the .skin file

<%@. Register Assembly="IMK.WebParts" Namespace="IMK.WebParts"
TagPrefix="IMK" %
<IMK:IMKDateWebPart runat="server">
<FromCalendar BackColor="#FFFFCC">
<SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
<TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt"
ForeColor="#FFFFCC" />
</FromCalendar>
</IMK:IMKDateWebPart>
=======================

I'm not sure whether this will cause error since I haven't tested it.
However, IMO, I'd prefer expose a single string property on my custom web
control which represent the nested child calendar's Theme(or
stylesheettheme). Since the ASP.NET 2.0 's Theme are mostly for those
simple type properteis (such as string, int), I think just exposing a
single string type property will be much better). You can do the actual
Theme adjusting in the Property's Setter method.
How do you think ?

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
I get your point about using simple strings. One thing though, say you expose
a color, this can be specified using a name like 'Red' or it may be specified
using hex notation, like '#FFCC66'. The controls require a Color object, how
does one map between the different representations and the Color object. Are
there any utility classes I can use?

I have now done a bit more experimenting. If I declaratively add the webpart
to a webpartzone, then the theme is correctly applied. If I add the same
webpart to the zone using a catalog, the style is not applied. The catalog
I'm adding from is a custom created one, not one of the predefined types.

Any suggestions?

"Steven Cheng[MSFT]" wrote:

> Hi c_kimbell,
> Thanks for your followup.
> As you mentioned that
> =================
>
> 1. On the webpart I have exposed the Calendar as a property with the name
> FromCalendar.
> 2. I have added the following to the .skin file
> <%@. Register Assembly="IMK.WebParts" Namespace="IMK.WebParts"
> TagPrefix="IMK" %>
> <IMK:IMKDateWebPart runat="server">
> <FromCalendar BackColor="#FFFFCC">
> <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
> <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt"
> ForeColor="#FFFFCC" />
> </FromCalendar>
> </IMK:IMKDateWebPart>
> =======================
> I'm not sure whether this will cause error since I haven't tested it.
> However, IMO, I'd prefer expose a single string property on my custom web
> control which represent the nested child calendar's Theme(or
> stylesheettheme). Since the ASP.NET 2.0 's Theme are mostly for those
> simple type properteis (such as string, int), I think just exposing a
> single string type property will be much better). You can do the actual
> Theme adjusting in the Property's Setter method.
> How do you think ?
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Hi c_kimbell,

For those Color field, the ASP.NET runtime's ControlParser will help parse
the property value into the correct object instance. And for Color, there
is the ColorTranslator class which can be used from convert string color
value to System.Drawing.Color instance. For example:

string htmlColor = "Blue";
//or string htmlColor = "#3344ee";
// Translate htmlColor to a GDI+ Color structure.
Color myColor = ColorTranslator.FromHtml(htmlColor);

For the applying theme for custom created catalog's webpart, I'm not sure
whether this is ok. As far as I know, since the ASP.NET2.0 runtime apply
theme for controls in the page's PreInit event, so any change on Theme
after that event (for example in Page_load ..., post back event) will not
work in the first loading...

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Saturday, March 24, 2012

This page can not be saved

Hi,

There are web sites that it is not possible to save the site locally.
(File-> Save As... returns error)
How can i do that with my own pages.

Thanks,
AliHi Ali,

Thanks for posting in the community! My name is Steven, and I'll be
assisting you on this issue.
From your description, you found that sometimes when you use the IE's
File->Save As menu item to save a certain web
site's page to local disk, you encountered some errors which prevent you
from finishing such operation.
Also, you'd like to implement the same effect for your own site or pages,
yes?
If there is anything I misunderstood, please feel free to let me know.

Based on my understanding, here is my suggestions:
1. Generally, when we view a web page in the Browser(such as IE or Mozilla
or..), the page's html source has been already downloaded to the local disk
on the client machine. It is in the internet tempory folder. So as for the
situation you mentioned, I think the error is likely to be caused two
things:
1) The page may have related or linked any other resources which prevent
you from downloading it so that it cause the error. If so, you may try use
the "View Source" menu of the browser and try viewing the page's html
source. If ok, you can still by copy the source and save it as a html file
manually, we still can download it :).
2) There does occurs some third party techniques on how to encrypt the web
page's html source from being cracked or protect some certain web resources
from being download. Such function is implemented by doing some certain
modification on the page's source code.

2. Here is some third party components which provide some similiar
funcitons on protecting page source or web resources. You may have a view
on them:
#Html Protector --protect your page's html source
http://www.minihttpserver.net/htmlg/index.php

#Web document download protection tool
http://ebizwhiz-publishing.com/ebookprotect.htm

#How to prevent theft of your source code
http://www.vortex-webdesign.com/help/hidesource.htm

Please check out the preceding suggestions. If you have any questions,
please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi Ali,

Have you had a chance to check out my suggestions or have you got any ideas
on this issue? If you need any further help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Yes I did. Now I underestand that for protect page scripts we need to use
3rd party products.
Thanks for help.
Ali

"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:zoeKSV$5DHA.1988@.cpmsftngxa07.phx.gbl...
> Hi Ali,
>
> Have you had a chance to check out my suggestions or have you got any
ideas
> on this issue? If you need any further help, please feel free to post
here.
>
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)

this trouble me a long time :(

Hi,

I developed some applications in asp & asp.net and running together under iis5.
I found they have own set of variables each of them, that is to say, they cannot pass a variable between the asp and asp.net applications.

i.e.
I set a session in asp: session("counter") = 100
I cannot get its value in asp.net by: session["counter"] because "counter" not be given.

I do wanna exchange information between them, but how can I? Any good idea?

thanksSession sharing between ASP and ASP.NET

Remember, Google knows all.