.ascx.g.cs文件不能生成 The name ‘InitializeControl’ does not exist in the current context - Visual Web part Sharepoint
InitializeControl doesn't exsit
SharePoint 2013 Visual web parts either of type sandbox solution or farm
solution you might face a the following error:
“The name InitializeControl” does not exist with
the current context”

the error, as shown in the image above this error occurs on the OnInit
Method.
method is part of the web part life cycle, which is responsible for
initialization the controls inside the web part (as example label, button, textbox and
others).
you will realize that this issue relates to controls inside the web
part.
designer file of type “ascx.g.cs” is missing, this file is responsible for
drawing the controls that are mapped with the visual web
part.

This issue
could occur by two reasons, as follows
solution is not using an existing or valid URL, by checking the SharePoint URL
please make sure that the URL is valid and exists, try to map the URL and build
your solution and check the result if the error still
exists.
the error still exists and the URL you are using is correct then we will do some
manual steps on top of visual studio as follows
new item
user control as shown below, its better to name this user control by the same
name of your visual web part, as example if your web part called Visual Web part
1, then for the User control name it as Visual Web part 1

c.The
user control will resides under the ControlTemplates folder (Mapped folder) as
shown below

sure to delete the “VisualWebPart1.ascx” as shown below

e.
Then
we will drag the VisualWebPart1.ascx that resides in the ControlTemplates folder
and drop it under the VisualWebPart1 , this will add the new user control
including its designer under the VisualWebPart1, your solution should look like
below

f.
Now try to add “Label” as example and build your solution, the result is
great and the error has gone.
repeat same steps for any new visual web part?
The answer is No, simply you can remove
the old web part , then add a new visual web part and the Visual Studio will
automatically create the “ascx.designer.cs” file for you ,so consider your
visual was stuck but then it works properly.
referring to:http://samer-othman.blogspot.com/2013/03/how-to-fix-error-name-initializecontrol.html
.ascx.g.cs文件不能生成 The name ‘InitializeControl’ does not exist in the current context - Visual Web part Sharepoint的更多相关文章
- Day Tip:SharePoint 2013 *.ascx.g.cs文件
在开发SharePoint2013的WebPart时,会产生一个*.ascx.g.cs文件.如果用TFS管理源代码经常遇到这个文件丢失.这让人很困扰,如果丢失了请在如下图中添加如下代码: ...
- C# 调用WebService的3种方式 :直接调用、根据wsdl生成webservice的.cs文件及生成dll调用、动态调用
1.直接调用 已知webservice路径,则可以直接 添加服务引用--高级--添加web引用 直接输入webservice URL.这个比较常见也很简单 即有完整的webservice文件目录如下图 ...
- 根据wsdl文件生成webservice 的.cs文件 及 生成dll C#调用
Visual Studio 2013->Visual Studio Tools->VS2013 开发人员命令提示 命令行输入 wsdl E:\WS.wsdl /out ...
- 2014-08-22 关于Response、Request等对象在cs文件中的使用
今天是在吾索实习的第33天.已经有一段时间没写过博客了,今天突然想起个值得分享的东西,所以又华丽地回归了. 废话不多说了,直奔主题.我们会发现,在我们在cs文件中,直接使用Response.Reque ...
- WPF根据Oracle数据库的表,生成CS文件小工具
开发小工具的原因: 1.我们公司的开发是客户端用C#,服务端用Java,前后台在通讯交互的时候,会用到Oracle数据库的字段,因为服务器端有公司总经理开发的一个根据Oracle数据库的表生成的cla ...
- .wsdl文件生成.cs文件
1.打开VS文件命令行工具(一般在安装文件的Common7\Tools\Shortcuts下面例如[E:\VS2013安装程序\Common7\Tools\Shortcuts\VS2013 x64 本 ...
- VS2010 根据WSDL文件(java Web Service)生成.cs文件
我们添加webService引用,一般是通过 添加服务引用完成的,其实 添加服务引用 在背后为我们生成了代理类. 我们手动生成代理类方法: 1.通过java Web Service,生成wsdl文件: ...
- 用csc命令行手动编译cs文件
一般初学c#时,用记事本写代码,然后用命令行执行csc命令行可以编译cs文件.方法有两种 1:配置环境,一劳永逸 一般来说在C:\Windows\Microsoft.NET\Framework\v4. ...
- 为何没有.aspx.designer.cs文件?
designer.cs 是窗体设计器生成的代码文件,作用是对窗体上的控件做初始化工作(在函数InitializeComponent()中)VS2003以前都把这部分代码放到窗体的cs文件中,由于这部分 ...
随机推荐
- POJ 2182【树状数组】
题意: 每头牛有编号,他们乱序排成一排,每头牛只知道前边比自己序号小的有几位. 思路: 递推,最后一只牛的编号是确定的,然后不断进行区间更新,直到找到某个空位前方恰好有n个空位. 这题跟某道排队的题思 ...
- (medium)LeetCode 236.Lowest Common Ancestor of a Binary Tree
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According ...
- (转)C# WinForm获取当前路径汇总
Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏本文来源 :http://www.cnblogs.com/greatverve/archive/2011/12/15/winform- ...
- Rman-03002,Rman-12010,Rman-12012
为什么会出现如此的错误呢? 答:因为我们在分配通道时设备类型分配为磁带,但是你并没有安装磁带设备,所以就会出现这样的错误. 错误如下: 解决方法: 登陆你的目标数据库,重新进行设置,命令如下: con ...
- 区间k大数查询
问题描述 给定一个序列,每次询问序列中第l个数到第r个数中第K大的数是哪个. 输入格式 第一行包含一个数n,表示序列长度. 第二行包含n个正整数,表示给定的序列. 第三个包含一个正整数m,表示询问个数 ...
- 过河-状压DP
http://www.luogu.org/problem/show?pid=1052 题目描述 在河上有一座独木桥,一只青蛙想沿着独木桥从河的一侧跳到另一侧.在桥上有一些石子,青蛙很讨厌踩在这些石子上 ...
- 洛谷P1473 零的数列 Zero Sum
P1473 零的数列 Zero Sum 134通过 170提交 题目提供者该用户不存在 标签USACO 难度普及/提高- 提交 讨论 题解 最新讨论 路过的一定帮我看错了我死了- 题目描述 请考虑 ...
- office 2003和office 2013同时安装使用的问题
电脑上同时安装了Office 2003和Office 2007/2010,先打开Word 2003,然后再打开Word 2010,总会弹出安装配置界面,反之亦然. 解决方法:使用快捷键Win+R打开 ...
- frame和iframe的区别
转自:http://blog.csdn.net/lyr1985/article/details/6067026 CSDN 1.frame不能脱离frameSet单独使用,iframe可以 ...
- 如何更新Linux源
首先需要自己收藏几个可以得到Linux源的站点,比如:http://mirrors.163.com/ (163的镜像站):可以百度搜索[Linux镜像站]: 下面这些镜像站,转自:http://www ...