当前注册人数423093人 邮箱: 密码: 注册新用户 忘记密码
首页 C/C++/MFC C# ASP.NET VB.NET MATLAB Android   站内搜索 下载代码说明/积分规则
为什么要注册?

1. 可以直接免费从本站下载代码,防止邮件发送不到您的邮箱,或登录不了国外网站

2. 可以设定关键字,当有您关心的代码收录时,邮件通知您

3. 对这里的代码进行评分和评论

4. 可以和大家一起分享你的源代码,得到更多的建议

40万国外源码搜索
200万国内源码搜索
相关源代码

A Tutorial for Binding Data in WebControl to manipulate in the Properity Window

在ASP.NET下的Web控件中实现数据绑定属性教程及代码

2008年05月21日
C#.NET 1.0, Win2K, WinXP, Windows, .NET, ASP.NET, Visual Studio, Dev
这个程序及文章教你如何让你的WebControl支持数据绑定,从而可以和标准的.NET控件一样,直接在属性窗口中绑定数据。
相关知识

What I intend to do is explain each step of the process and describe what you actually need to do support data binding in a WebControl against what the MSDN sample says you have to do. For this demonstration I created a very simple control that does nothing other than expose properties that can be used to bind to a data source, a table within that data source and finally some fields that reside in that table in the same manner as a listbox.

 

public class SimpleDataBoundControlDesigner : ...
{
    ...

    IEnumerable IDataSourceProvider.GetResolvedSelectedDataSource() 
    {
        object selectedDataSource = 
            ((IDataSourceProvider)this).GetSelectedDataSource();

        DataView dataView = null;

        if (selectedDataSource is DataSet)
        {
            // find the correct table or if non set the look up the first table

            DataSet dataSet = (DataSet)selectedDataSource;
            DataTable dataTable = null;

            if ((DataMember != null) && (DataMember.Length>0))
                dataTable = dataSet.Tables[DataMember];
            else
                dataTable=dataSet.Tables[0];

            // we found a table so lets just get its default view

            if (dataTable!=null) 
            {
                dataView = dataTable.DefaultView;
            }
        }
        else if (selectedDataSource is DataTable)
        {
            // just get the default view since we have just been given a table

            dataView = ((DataTable)selectedDataSource).DefaultView;
        }
        else if (selectedDataSource is IEnumerable)
        {
            // might as well just see if it will cast as this is 

            // the MS sample's default

            return selectedDataSource as IEnumerable; 
        }

        return dataView as IEnumerable;
    }

}
源代码原文下载:
Data Binding in WebControls An article on how to actually support data binding in your WebControl such that you can manipulate them in the Properties window.

源码图片

点击链接查看大图
从本站下载附件及源代码(1个附件,已经成功下载57次)

最值得关注的外文源代码

Event Calendar [ ASP.NET 2.0 / C# ]
Binding ASP.NET TreeView to a DataSet or an ObjectDataSource
评论(评论是增加积分的一个有效途径)
字数在300字内
请如实评论
本源代码共评论14次,此处显示最近8次评论! 查看所有评论

syldjzl  2012年11月18日
学习一下
zffanfan  2012年04月04日
天涯沙漠  2011年02月01日
应该不错哦。
有心  2009年01月19日
怎么没有过找到在哪里
maoxiaofeng  2008年10月12日
谢谢啊
maoxiaofeng  2008年10月12日
谢谢啊
leiryhp  2008年08月26日
在ASP.NET下的Web控件中实现数据绑定属性教程及代码
mjsir  2008年07月30日
123
字数在300字内
请如实评论
200万国内源码搜索
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved zhihuishi   免责声明