当前位置: 首页>>代码示例>>C#>>正文


C# DataControlField.GetType方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.DataControlField.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# DataControlField.GetType方法的具体用法?C# DataControlField.GetType怎么用?C# DataControlField.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.DataControlField的用法示例。


在下文中一共展示了DataControlField.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetProperty

 private static void SetProperty(DataControlField target, string propertyName, object value)
 {
     target.GetType().GetProperty(propertyName).SetValue(target, value, null);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:AddDataControlFieldDialog.cs

示例2: GetButton

        private WebControl GetButton(DataControlField fld, string commandName, string commandArg, int itemIdx, int colIdx, string buttonText, string imgUrl)
        {
            ButtonType btnType = ButtonType.Button;
            if (fld is CommandField)
                btnType = ((CommandField)fld).ButtonType;
            else if (fld is ButtonField)
                btnType = ((ButtonField)fld).ButtonType;
            else
                throw new Exception("Unrecognized DataControlField type: " + fld.GetType().Name);


            switch (btnType)
            {
                case ButtonType.Button:
                    {
                        Button btn = new Button();
                        btn.ID = string.Format("btn{0}_{1}_{2}", commandName, itemIdx, colIdx);
                        btn.Text = buttonText;
                        btn.CommandName = commandName;
                        btn.CommandArgument = commandArg;

                        return btn;
                    }
                case ButtonType.Link:
                    {
                        LinkButton lnk = new LinkButton();
                        lnk.ID = string.Format("lnk{0}_{1}_{2}", commandName, itemIdx, colIdx);
                        lnk.Text = buttonText;
                        lnk.CommandName = commandName;
                        lnk.CommandArgument = commandArg;

                        return lnk;
                    }
                case ButtonType.Image:
                    {
                        ImageButton img = new ImageButton();
                        img.ID = string.Format("img{0}_{1}_{2}", commandName, itemIdx, colIdx);
                        img.ImageUrl = imgUrl;
                        img.CommandName = commandName;
                        img.CommandArgument = commandArg;

                        return img;
                    }
                default:
                    throw new Exception("Unrecognized control ButtonType: " + btnType.ToString());
            }
        }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:47,代码来源:GridView.cs


注:本文中的System.Web.UI.WebControls.DataControlField.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。