摘要: NetShopForge是一款强劲的B2C的网上购物软件,利用她我们能建立起强劲的、自由的、安全的购物平台。 系统基于ASP.NET 2.0及SqlServer开发,充分享受新技术带来的乐趣。 软件综合了卖家,买家,程序员,设计者的头脑风暴,目的就是用户能建立风格不同的电子商务系统,使它显得更加与众不同。 如果您寻求一款能按您的思想随意发挥的网上购物软件,那么NetShopForge将是您最佳的选择!   阅读全文
posted @ 2008-07-11 13:36 涟漪勇 阅读(796) | 评论 (13)编辑

原文:http://blogs.msdn.com/carloc/archive/2007/05/23/broken-line-in-asp-net-2-0-treeview-in-ie-7.aspx

Create a very simple page in ASP.NET 2.0, add a TreeView control and set ShowLines=true; now browse the page with Internet Explorer 7: you'll very likely see something like this:

treeview broken lines

In IE 6 this looks good... smile_thinking

The point is that Internet Explorer 7 changes the boxing model: now a box that's too small to accomodate ita content won't stretch like it does on all other browsers including IE6, it will try to stay as small as possible. The problem in this case is that the DIV tags generated by the control are just 1 pixel height, which was working fine until now. Here is how the "View source" for the page above looks:

   1: [...]
   2: <table cellpadding="0" cellspacing="0" style="border-width:0;">
   3:     <tr>
   4:         <td>
   5:             <div style="width:20px;height:1px">
   6:                 <img src="/TreeViewSample/WebResource.axd?d=vGK_uMmdWLf5UZMMUhv9tSAl-YQg-jrsZ90xzYAI6TE1&amp;t=632985107273882115" alt="" />
   7:             </div>
   8:         </td>
   9:         <td>
  10:             <a id="TreeView1n1" href="javascript:TreeView_ToggleNode(TreeView1_Data,1,TreeView1n1,'l',TreeView1n1Nodes)">
  11:                 <img src="/TreeViewSample/WebResource.axd?d=vGK_uMmdWLf5UZMMUhv9tfjlKbdZ_ojL4O8CY0ydKO_HFK9lO1t2cZ2AjaDIqJy_0&amp;t=632985107273882115" 
  12:                 alt="Collapse New Node" style="border-width:0;" />
  13:             </a>
  14:         </td>
  15:         <td style="white-space:nowrap;">
  16:             <a class="TreeView1_0" href="javascript:__doPostBack('TreeView1','sNew Node\\New Node')" 
  17:                 onclick="TreeView_SelectNode(TreeView1_Data, this,'TreeView1t1');" id="TreeView1t1">New Node</a>
  18:         </td>
  19:     </tr>
  20: [...]

As you can see, the first DIV tag contains a style definition with "height:1px"; that's the problem.

And now, here is how we can sort this out:

  • Create a new style definition in your page (or create an external .css file and link it in your pages, pedending on your needs)
  • Add the following class definition: ".tree td div {height: 20px !important}" (of course without quotation marks)
  • In your TreeView component add a referende to CssClass="tree"

Note that normally the style defined in the DIV takes precedence over the style defined at page level (or external .css file), but since in this case we need to override that setting, we can use the !important CSS directive; here is how the modified source looks like:

   1: [...]
   2: <html xmlns="http://www.w3.org/1999/xhtml">
   3: <head runat="server">
   4:     <title>Untitled Page</title>
   5:     <style>
   6:         .tree td div {
   7:             height: 20px !important
   8:         }
   9:     </style>
  10: </head>
  11: <body>
  12:     <form id="form1" runat="server">
  13:         <div>
  14:             <asp:TreeView ID="TreeView1" runat="server" ShowLines="True" CssClass="tree">
  15:                 <Nodes>
  16:                     <asp:TreeNode Text="New Node" Value="New Node">
  17:                         <asp:TreeNode Text="New Node" Value="New Node">
  18:                             <asp:TreeNode Text="New Node" Value="New Node">
  19: [...]

And the resulting page:

treeview fixed lines

posted @ 2009-03-19 14:56 涟漪勇 阅读(105) | 评论 (0)编辑
     摘要: Team Foundation讲义,分三部分阐述,Team Foundation概述,Team Foundation功能,Team Foundation安全性。 有讲义的PPT下载。  阅读全文
posted @ 2009-02-17 10:39 涟漪勇 阅读(1440) | 评论 (12)编辑
     摘要: 证书注册API(Certificate Enrollment API)的功能是用于在客户端程序请求一个证书,请求批准后得到一个证书,然后安装证书。从vista开始使用的市CertEnroll.dll,之前使用的都是Xenroll.dll,下面的代码实现了这些功能  阅读全文
posted @ 2008-12-15 16:27 涟漪勇 阅读(1611) | 评论 (2)编辑
     摘要: WSS(Windows SharePoint Services) KeywordQuery可执行关键字语法搜索查询,可以将搜索条件直接传递给搜索组件而无需通过搜索条件来分析以生成查询。  阅读全文
posted @ 2008-12-08 13:12 涟漪勇 阅读(1171) | 评论 (0)编辑

WebPart中对SharePoint Web Service的身份验证(Form Authentication)

主要是拿到Request中的Cookie(system.web.HttpCookie)转换成CookieContainer中需要的Cookie(system.net.Cookie)
假设我们使用最常用的lists.asmx来获取SharePoint列表数据,添加的Web引用的命名空间是spwsList

            Dim serviceURL As String = SPContext.Current.Site.OpenWeb.Site.Url & "/_vti_bin/lists.asmx"
            
Dim server As spwsList.Lists = Nothing
            server 
= New spwsList.Lists
            server.CookieContainer 
= New Net.CookieContainer

            
For i As Integer = 0 To Me.Context.Request.Cookies.Count - 1
                
Dim c As Web.HttpCookie = Me.Context.Request.Cookies(i)
                
If c.Name.ToUpper = ".ASPXAUTH" Then
                    
Dim coo As New Net.Cookie(c.Name, c.Value, c.Path)
                    server.CookieContainer.Add(
New Uri(serviceURL), coo)
                    
Exit For
                
End If
            
Next
            
Return server

 

--------------------以下转载自http://blog.joycode.com/erucy/archive/2008/07/28/115205.aspx--------------------

 SharePoint内置了一套相对比较完整的Web Services提供给开发者,这样就可以在客户端、跨平台的程序中读取甚至修改SharePoint中的内容。不过当SharePoint网站不允许匿名访问的时候,调用Web Services自然也需要提供身份验证。

    SharePoint身份验证最常用的是Windows验证(Windows Authentication)和表单验证(Form Authentication)两种。

    Windows验证即使用Windows账号或者AD账号来进行身份验证,对于这种验证方式,在SharePoint SDK中已经给出了如何提供身份验证的方法,假设我们使用最常用的lists.asmx来获取SharePoint列表数据,添加的Web引用的命名空间是spwsList:

 

使用当前帐户身份:
1 spwsList.Lists wsLists = new spwsList.Lists(); 2 wsLists.Credentials = CredentialCache.DefaultCredential; 3 Console.WriteLine(wsLists.GetListCollection().OuterXml);

使用指定帐户:
1 spwsList.Lists wsLists = new spwsList.Lists(); 2 wsLists.Credentials = new NetworkCredential("username", "password", "domain"); 3 Console.WriteLine(wsLists.GetListCollection().OuterXml);

 

    上面的CredentialCache、NetworkCredential都是在System.Net命名空间下。

 

    表单认证是SharePoint 2007新加入的一种身份认证方式,其后台是使用.Net Framework中的Membership机制进行用户身份的识别,对于外网来说,大都是使用表单认证的方式来实现的。在使用表单认证的SharePoint网站中通过Web Service获取数据稍微麻烦一些,不过也可以通过SharePoint提供的表单认证Web Service来创建用户身份相关的Cookie。

    表单认证Web Service的地址是:http://[server]/[site]/_vti_bin/authentication.asmx

    在使用Web Service的程序中再次加入上面这个Web引用,假设其命名空间是spwsAuth,那么使用表单认证构造身份并访问数据的代码实例如下:

1 spwsAuth.Authentication auth = new spwsAuth.Authentication(); 2 auth.CookieContainer = new CookieContainer(); 3 auth.AllowAutoRedirect = true; 4 spwsAuth.LoginResult lr = auth.Login("username", "password"); 5 if (lr.ErrorCode == spwsAuth.LoginErrorCode.NoError) 6 { 7 spwsList.Lists wsList = new spwsList.Lists(); 8 wsList.CookieContainer = auth.CookieContainer; 9 XmlNode res = wsList.GetListCollection(); 10 Console.WriteLine(res.OuterXml); 11 }

 

 

 

posted @ 2008-11-10 17:38 涟漪勇 阅读(1091) | 评论 (1)编辑

在做一个webPart的时候需要以编程的方式显示一个DocumentLibary。其中用到了ListViewWebPart。用到了一些代码,分享一下。

        Private docLib As SPDocumentLibrary = Nothing
        
Private view As SPView = Nothing
        
Private Web As SPWeb = Nothing

 

1.初始化(其中的_docLibID和_viewID是属性的私有字段,这个通过GetToolParts方法设置的WebPartToolPart已经被赋值)

        Private Sub InitConfiguration()

            Web 
= SPContext.Current.Site.OpenWeb(SPContext.Current.Web.ServerRelativeUrl)

            
Dim list As SPList = Nothing
            
Try
                list 
= Web.Lists(_docLibID)
                
If list.BaseType = SPBaseType.DocumentLibrary Then
                    docLib 
= TryCast(list, SPDocumentLibrary)
                
End If
            
           
'Set view
            If Me._viewID = Guid.Empty Then
                view 
= docLib.DefaultView
            
Else
                view 
= docLib.Views(Me._viewID)
            
End If
        
End Sub


2.如何创建一个ListViewWebPart 的ToolBar(是根据ListViewWebPart的数据源有关)

只需创建一个SPContex,然后传入view,docLib及其他的信息即可,然后把这个SPContext赋给toolBar的RenderContex即可。

       Private Sub AddViewToolBar()
            
Dim toolbar As New ViewToolBar
            
Dim context As SPContext = SPContext.GetContext(Me.Context, view.ID, docLib.ID, SPContext.Current.Web)

            toolbar.RenderContext 
= context
            Controls.Add(toolbar)
        
End Sub

 

3.如何创建ListViewWebPart
我把创建的ListViewWebPart放在了一个Panel上面,代码中有个disableToobar这个是移除ListViewWebPart中的ToolBar(看第4,当我们指定ViewGuid ,默认的模式是说含有ToolBar的,这将导致工具栏显示在webpart页)
重要的是给ListName和ViewGui赋值

      Private Function renderExplorerView() As Panel
            
Dim panel As New Panel
            
Dim wp As New ListViewWebPart
            wp.ListName 
= docLib.ID.ToString("B").ToUpper()
            wp.ViewGuid 
= view.ID.ToString("B").ToUpper
            DisableToolbar(wp)
            wp.GetDesignTimeHtml()
            panel.Controls.Add(wp)
            
Return panel
        
End Function

 

4.如何移除ListViewWebPart中的ToolBar
主要是对SPView中的SPView.ToolbarType设置。在MSDN上是这样描述SPView.ToolbarType
Standard —The most common type of toolbar, which is used, for example, in the All Items views for most lists, and which corresponds to Full Toolbar in the Web Part tool pane.
FreeForm —Used in Default.aspx and Web Part Pages and corresponds to Summary Toolbar in the Web Part tool pane.
None —No toolbar is used in the view, corresponding to No Toolbar in the Web Part tool pane.
我们的目的就是设置ToolbarType是None
VB

 Private Sub DisableToolbar(ByVal lv As ListViewWebPart)
            
' Extract view 
            Dim ViewProp As System.Reflection.PropertyInfo = lv.[GetType]().GetProperty("View", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance)

            
Dim spView As SPView = TryCast(ViewProp.GetValue(lv, Nothing), SPView)
            
Dim txt As String = spView.SchemaXml
            
Dim NodeProp As System.Reflection.PropertyInfo = spView.[GetType]().GetProperty("Node", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance)
            
Dim node As XmlNode = TryCast(NodeProp.GetValue(spView, Nothing), XmlNode)
            
Dim tBarNode As XmlNode = node.SelectSingleNode("Toolbar")

            
If tBarNode IsNot Nothing Then
                
Dim typeNode As XmlAttribute = tBarNode.Attributes("Type")
                
' make the contents empty so we realy remove the toolbar .. 
                ' otherwise you might get a different type of toolbar popup when we have a 
                ' Migrated site from 2.0 
                tBarNode.RemoveAll()
                
' re-add the type attribute 
                tBarNode.Attributes.Append(typeNode)
                
' finally set the toolbar to not show
                typeNode.Value = "None"
            
End If
            
'This forces a refresh of the views internal xml or the node's cild nodes are not populated 
            Web.AllowUnsafeUpdates = True
            spView.Update()
            Web.AllowUnsafeUpdates 
= False
        
End Sub

C#

private static void DisableToolbar(ListViewWebPart lv)
{
 
//  Extract view 
   System.Reflection.PropertyInfo ViewProp = lv.GetType().GetProperty("View"
    System.Reflection.BindingFlags.NonPublic 
| System.Reflection.BindingFlags.Instance);

   SPView spView 
= ViewProp.GetValue(lv, nullas SPView;

   
string txt = spView.SchemaXml;

   System.Reflection.PropertyInfo NodeProp 
= spView.GetType().GetProperty("Node"
     System.Reflection.BindingFlags.NonPublic 
| System.Reflection.BindingFlags.Instance);

   XmlNode node 
= NodeProp.GetValue(spView, nullas XmlNode;
   XmlNode tBarNode 
= node.SelectSingleNode("Toolbar");

   
if (tBarNode != null)
   {
      XmlAttribute typeNode 
= tBarNode.Attributes["Type"];
      
// make the contents empty so we realy remove the toolbar ..
      
// otherwise you might get a different type of toolbar popup when we have a 
      
// Migrated site from 2.0
      tBarNode.RemoveAll();
      
// re-add the type attribute
      tBarNode.Attributes.Append(typeNode);
      
// finally set the toolbar to not show.
       typeNode.Value = "None";
    }
//This forces a refresh of the views internal xml or the node's cild nodes are not populated 
 spView.Update();
}

 

5.参考资料
Create custom ListViewWebPart
http://www.sharepointkings.com/2008/08/create-custom-listviewwebpart.html
d
Update ListViewWebPart to Remove or Hide Toolbar ToolbarType="None"
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/96aac2dd-29fc-4e63-8730-9d1adc01b826/

posted @ 2008-10-28 15:44 涟漪勇 阅读(694) | 评论 (1)编辑
     摘要: 免费的sharePoint webpart,How to...,MSDN文章精选,SharePoint 工具.....  阅读全文
posted @ 2008-10-28 09:51 涟漪勇 阅读(266) | 评论 (0)编辑
     摘要: Enum操作技巧,1.得到枚举中常数值的数组 2. 检索指定枚举中常数名称的数组 3.转换Integer常数值和转换一个String常数名到Eumn示例 4.结合Attribute的到附加属性  阅读全文
posted @ 2008-09-12 17:00 涟漪勇 阅读(387) | 评论 (0)编辑
     摘要: NET Language Integrated Query (LINQ):采用通用方案来解决各种信息源的访问与整合问题 .... LINQ to SQL, LINQ to XML ,资源。   阅读全文
posted @ 2008-08-29 12:40 涟漪勇 阅读(1595) | 评论 (2)编辑
     摘要: NetShopForge是一款强劲的B2C的网上购物软件,利用她我们能建立起强劲的、自由的、安全的购物平台。 系统基于ASP.NET 2.0及SqlServer开发,充分享受新技术带来的乐趣。 软件综合了卖家,买家,程序员,设计者的头脑风暴,目的就是用户能建立风格不同的电子商务系统,使它显得更加与众不同。 如果您寻求一款能按您的思想随意发挥的网上购物软件,那么NetShopForge将是您最佳的选择!   阅读全文
posted @ 2008-07-11 13:36 涟漪勇 阅读(796) | 评论 (13)编辑


方法一:在一个js文件中引用一个包含scriptmanager的ASP.NET页面(如下图1),在js文件中可以得到整个Micrsoft AJAX库和附加脚本的智能感知(intellisense).添加///<reference/>语句的最简单方法是从solution explorer中拖.aspx页面到你要添加引用的js文件。VS会自动的给你添加引用。

 js_intellisense

方法二:用单独的.js文件,可以添加这样的引用实现感知的功能
/// <reference name="MicrosoftAjax.debug.js" />

js_intellisense2

posted @ 2008-05-14 15:04 涟漪勇 阅读(1351) | 评论 (7)编辑
     摘要: 以下术语定义适用于 Windows Communication Foundation (WCF)。   阅读全文
posted @ 2008-02-29 15:28 涟漪勇 阅读(257) | 评论 (0)编辑
     摘要: 摘要: 新的数据源控件和数据绑结构是很棒的特性,它可以简化程序的调试时间,这一些列文章,让我们了解数据源控件的基本结构。这是第三部分,介绍DataSourceView类。  阅读全文
posted @ 2007-11-13 15:36 涟漪勇 阅读(1807) | 评论 (1)编辑
     摘要: 新的数据源控件和数据绑结构是很棒的特性,它可以简化程序的调试时间,这一些列文章,让我们了解数据源控件的基本结构。这是第二部分,介绍DataSourceControl类。  阅读全文
posted @ 2007-11-12 15:08 涟漪勇 阅读(2072) | 评论 (9)编辑
     摘要: 新的数据源控件和数据绑结构是很棒的特性,它可以简化程序的调试时间,这一些列文章,让我们了解数据源控件的基本结构。  阅读全文
posted @ 2007-11-09 11:17 涟漪勇 阅读(2107) | 评论 (7)编辑
     摘要: 这篇文章展示了如何创建一个自定义的数据源控件和怎样给它增加完整的设计时支持  阅读全文
posted @ 2007-11-07 11:48 涟漪勇 阅读(1959) | 评论 (5)编辑
     摘要: asp.net用户控件简单封装,其他的属性可以自己封装  阅读全文
posted @ 2007-04-05 11:40 涟漪勇 阅读(450) | 评论 (1)编辑
     摘要:
用ProtoType框架完成的一个下拉框(asp:DropDownList)联动的AJAX的小例子,和初学者分享一下.  阅读全文
posted @ 2006-12-18 17:59 涟漪勇 阅读(2714) | 评论 (7)编辑
     摘要: 管理用户存储配置信息,传入UserName参数,这样就可以管理全部的Profile
通过System.Web.Profile.ProfileBase得到指定的用户名创建配置文件的一个实例
  阅读全文
posted @ 2006-10-16 10:57 涟漪勇 阅读(1430) | 评论 (3)编辑
     摘要: ThickBox的ASP.NET实现  阅读全文
posted @ 2006-09-05 12:19 涟漪勇 阅读(1881) | 评论 (5)编辑
     摘要: 介绍两个网站分别介绍了如何利用System.Net.Mail(.net2.0)或System.Web.Mail(.NET1.x)
www.SystemNetMail.com
www.SystemWebMail.com
  阅读全文
posted @ 2006-07-04 13:10 涟漪勇 阅读(1464) | 评论 (1)编辑

GridView中
<asp:HyperLink ID="linkProductImage" runat="server"  NavigateUrl='<%# String.Format("~/Shop/Product/ProductDetail.aspx?pID={0}",Eval("ProductID")) %>'  ImageUrl='<%String.Format("~/Shop/Product/GetImage.aspx?Imagepath={0}&Size={1}",Eval("ImagePath"),"120,120"%>'></asp:HyperLink>


DataGrid中
<asp:HyperLink ID="linkProductImage" runat="server"  NavigateUrl='<%# String.Format("~/Shop/Product/ProductDetail.aspx?pID={0}",DataBinder.Eval(Container.DataItem,"ProductID")) %>'  ImageUrl='<%String.Format("~/Shop/Product/GetImage.aspx?Imagepath={0}&Size={1}",DataBinder.Eval(Container.DataItem,"ImagePath"),"120,120"%>'></asp:HyperLink>



祝贺第100篇随笔
posted @ 2006-06-20 14:11 涟漪勇 阅读(835) | 评论 (1)编辑
     摘要: 在MasterPage中设置了HTML 元素的信息,可以应用到所有使用MasterPage的页面.但在实际应用中并不是所有的页面都使用一样的东西,使用HTML 服务器控件可以设置使用MasterPage的页面的HTML信息  阅读全文
posted @ 2006-06-02 16:47 涟漪勇 阅读(1451) | 评论 (0)编辑

在.net2.0中MastePage使得的界面统一更容易,在PetShop4.0中看到这样的代码:


      private const string HEADER_PREFIX = ".NET Pet Shop :: {0}";

      
/// <summary>
      
/// Create page header on Page PreRender event
     
/// </summary>
   protected void Page_PreRender(object sender, EventArgs e) {    
        ltlHeader.Text 
= Page.Header.Title;
          Page.Header.Title 
= string.Format(HEADER_PREFIX, Page.Header.Title);          
    }

 

posted @ 2006-06-01 13:08 涟漪勇 阅读(534) | 评论 (0)编辑