HI,
I added a empty sharepoint 2013 solution, and in that added a Visual webpart 2013 project.
In the ascx, i added few textbox and buttons. I am not able to access the textbox in code behind, though the buttons are showing up? Is there anything to be changed for VS 2012?
Below is the ascx code:
<tr><td><asp:Label ID="lblFirstName" Text="First Name" runat="server"></asp:Label></td><td><asp:TextBox ID="txtFirstName" runat="server" ></asp:TextBox></td> </tr><asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
In the codebehind , i can see the below:
[ToolboxItemAttribute(false)] public partial class CustomWebPart : WebPart { // Uncomment the following SecurityPermission attribute only when doing Performance Profiling on a farm solution // using the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready // for production. Because the SecurityPermission attribute bypasses the security check for callers of // your constructor, it's not recommended for production purposes. // [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)] public CustomWebPart() { } protected override void OnInit(EventArgs e) { base.OnInit(e); InitializeControl(); }
How to access the controls in code behind?
Just checked the solution , the "ascx.designer.cs" is not available. Is there anything to be done different for 2013?
Thanks