понедельник, 3 мая 2010 г.

Отличия Microsoft WSS 3.0 и Microsoft Office SharePoint Server 2007



Пользователей, знакомых со службами Microsoft Windows SharePoint Services, может интересовать, как они связаны с Office SharePoint Server 2007. Windows SharePoint Services — это базовая технология, которая включена в Microsoft Windows Server 2003. Она обеспечивает производительность и взаимодействие групп благодаря предоставлению доступа к людям, документам и данным, необходимым для принятия обоснованных решений и эффективного выполнения работы. Office SharePoint Server 2007 основывается на технологии Windows SharePoint Services 3.0, обеспечивая знакомую и единообразную среду для списков и библиотек, администрирования и настройки узлов. Все возможности, доступные в Windows SharePoint Services 3.0, также доступны в Office SharePoint Server 2007.
Однако в Office SharePoint Server 2007 предлагаются расширенные и дополнительные возможности, которые отсутствуют в Windows SharePoint Services. Например, Office SharePoint Server 2007 и Windows SharePoint Services включают шаблоны узлов для совместной работы и подготовки собраний. Однако Office SharePoint Server 2007 включает ряд дополнительных шаблонов узлов, соответствующих различным потребностям предприятий и сценариям публикации.


В следующей таблице представлен краткий обзор возможностей, доступных в Windows SharePoint Services 3.0 и в выпусках Office SharePoint Server 2007 Standard Edition и Office SharePoint Server 2007 Enterprise Edition. Чтобы прочитать полное описание возможностей Microsoft Office SharePoint Server 2007 и Windows SharePoint Services 3.0, загрузите таблицу сравнения продуктов (XLS-файл, 168 КБ). Дополнительные сведения об этой универсальной технологии см. на веб-узле TechNetWindows SharePoint Services 3.0 (EN).

суббота, 1 мая 2010 г.

Using window.onload event



Some scripts require that you run something immediately after the web page finishes loading. The normal way to do this is to add an onload attribute to the body tag. You don't have to do it that way though, you can set up a global event handler to do it instead.
Why would you want to use a global event handler instead of just adding the code into the body tag? I can think of two reasons. Firstly by using a global event handler you make it easier to add the code to web pages because you don't have to edit the body tag, if you add the script into an existing external Javascript file attached to your page you may not need to edit the page at all. Secondly some web editors may limit your ability to add code easily to the body tag.



Example

  1. window.onload = function() {  
  2.   init();  
  3.   doSomethingElse();  
  4. };  
  1. <html>  
  2. <head>  
  3.   
  4. <title>onload testtitle>  
  5.   
  6. <script type="text/javascript">  
  7.   
  8. window.onload = load;  
  9.   
  10. function load()  
  11. {  
  12.  alert("load event detected!");  
  13. }  
  14. script>  
  15. head>  
  16.   
  17. <body>  
  18. <p>The load event fires when the document has finished loading!p>  
  19. body>  
  20. html>  

пятница, 30 апреля 2010 г.

How to: Disable ASP.NET Themes at Page Level




I've created a theme Css for my Asp.net 2.0 web application. The web.config Pages Theme key is set to the theme name. Everything seams to work fine except for any page that I want to disable the master theme and apply another stylesheet.css.

According to the documentation I've read. I should be able to disable the theme by setting the "enabletheming" attribute on the aspx Page to false. This doesn't seam to work. When I look at the source of the generated page I can see the link to the new stylesheet that I want but just prior to the body tag I also see a reference to asp.net theme stylesheet that I'm tring to disable.

Is this a bug? I've tried everything I know of to disable the theme at the page level.




The solution is to set Theme="" on the page:

<%@ Page Language="C#" EnableTheming="false" Theme="" %>

How to add a vertical or horizontal scrollbar to a ASP .NET Panel control?



Definition and Usage

The ScrollBars property is used to set or return the position and visibility of scroll bars in the Panel control


Syntax


Some Content

AttributeDescription
valueSpecifies the which scrollbars are shown or not shown.
Possible values:
  • None - Default. No scroll bars are shown
  • Horizontal - Only a horizontal scroll bar is shown
  • Vertical - Only a vertical scroll bar is shown
  • Both - Horizontal and vertical scroll bars are shown
  • Auto - Horizontal, vertical, or both scroll bars are shown if needed


Example

The following example sets the ScrollBars property to "Auto" in a Panel control:

<form runat="server">
<asp:Panel id="pan1" runat="server"
Height="100px" ScrollBars="Auto">

Some content

</asp:Panel>
</form>

вторник, 6 апреля 2010 г.

How to use a Save File Dialog in WPF?

The SaveFileDialog class defined in Microsoft.Win32 namespace represents Windows Save File Dialog control.


The following code snippet creates a SaveFileDialog, sets its default extension and fiter properties and calls ShowDialog method that displays SaveFileDialog control.



Microsoft.Win32.
SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
dlg.DefaultExt = 
".txt";
dlg.Filter = 
"Text documents (.txt)|*.txt"if (dlg.ShowDialog() == true )
   string filename = dlg.FileName;
}

How to serialize an object to XML by using Visual C#

Serialzation


Now here's the cool part. This is how serialization works:

ShoppingList myList = new ShoppingList();
myList.AddItem( new Item( "eggs",1.49 ) );
myList.AddItem( new Item( "ground beef",3.69 ) );
myList.AddItem( new Item( "bread",0.89 ) );


// Serialization
XmlSerializer s = new XmlSerializer( typeof( ShoppingList ) );
TextWriter w = new StreamWriter( @"c:\list.xml" );
s.Serialize( w, myList );
w.Close();

// Deserialization
ShoppingList newList;
TextReader r = new StreamReader( "list.xml" );
newList = (ShoppingList)s.Deserialize( r );
r.Close();

The first chunk of code is simply creating an instance of the ShoppingList class and populating it. After that, we have the serialization part. Here is where the object gets converted into XML. As you can see, all it requires is the use of the XmlSerializer class which is set to serialize anything of type ShoppingList (look at the constructor). The serializer does its work when the Serialize method is called and will output XML to any stream. In this case, we have it output to a file.
Next there is the deserialization part. Here we use the same serializer (since it's set to the right type) and we read in an XML file and the Deserialize method will create the appropriate ShoppingList class object. This code sample shows serialization from a file, but you could just as easily do it from an http stream.

четверг, 1 апреля 2010 г.

ASP.NET Web sites That Have EDMX files do not compile and deploy in partial trust



After finishing one of the websites that were developed using Entity framework , I published  it to godaddy hosting. When i tried to open the newly published site, i got the following error:


Parser Error Message: Type 'System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider' cannot be instantiated under a partially trusted security policy (AllowPartiallyTrustedCallersAttribute is not present on the target assembly).
After some investigation , I found that the mentioned error was caused by the following build Provider section that were placed in web.config by VS 2008:
<buildproviders>
<add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider"></add></buildproviders>
The “EntityDesignerBuildProvider” class is contained in  System.Data.Entity.Design.dll which does not have the AllowPartiallyTrustedCallersAttribute and so any call to it in the partial trust will fail.
when i removed the mentioned “buildProviders” section and refreshed the site, i got the following error:
The specified default EntityContainer name 'entity model name here' could not be found in the mapping and metadata information.
Parameter name: defaultContainerName.
After that i started to think that removing the mentioned section prevented the complier from compiling the entity model.
I think the problem is that since i didn’t precompiled the website and just copied it to the hosting server(using “copy website” option), the runtime will try to compile it dynamically (including the entity model “edmx" file) hence the first  mentioned error will occur.
many solutions comes to my head, like pre-compiling the website to avoid dynamic compilations on the hosting server, or just moving the entity model from App_code to a separate class library project which allow me to only build the class library project and publish the dll to the website Bin directory.
precompiling the website wasn’t an option for me because i know that i still need to apply partial updates to it and so i can’t re-upload the whole stuff every time i change something in the website.
So i selected the second solution.I goes a head and moved the entity model file “edmx” from the website App_Code  to a separate class library project.then compiled entity model project and added it’s resulted dll to the website Bin directory.
Problem solved :)
Hope that help you !