How to access asp.net controls from DNN skin code behind The Next CEO of Stack OverflowHow do you create a dropdownlist from an enum in ASP.NET MVC?Placing code behind for a DNN pageASP.NET making a user controlled template with WebControls in themHow to access HTML control in C# code behind without “runat=server”?How to Export Gridview Data in Pdf in DotNetNuke(DNN)?How to find a client side element in an update panel from code behind?Writing this HTML Control in ASP.NETHow to do Code Behind for a User Control FileHow to set Chart control width into percentageUnable to create a User Control Module for ASP.NET controls in DNN 8
Find the majority element, which appears more than half the time
Strange use of "whether ... than ..." in official text
It it possible to avoid kiwi.com's automatic online check-in and instead do it manually by yourself?
How do I keep Mac Emacs from trapping M-`?
What happens if you break a law in another country outside of that country?
What steps are necessary to read a Modern SSD in Medieval Europe?
Why do we say “un seul M” and not “une seule M” even though M is a “consonne”?
subequations: How to continue numbering within subequation?
How can I separate the number from the unit in argument?
How to pronounce fünf in 45
How does a dynamic QR code work?
Is the offspring between a demon and a celestial possible? If so what is it called and is it in a book somewhere?
Is it correct to say moon starry nights?
Does Germany produce more waste than the US?
Planeswalker Ability and Death Timing
Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?
Can a PhD from a non-TU9 German university become a professor in a TU9 university?
Avoiding the "not like other girls" trope?
A hang glider, sudden unexpected lift to 25,000 feet altitude, what could do this?
Physiological effects of huge anime eyes
Finitely generated matrix groups whose eigenvalues are all algebraic
Could a dragon use its wings to swim?
Is a linearly independent set whose span is dense a Schauder basis?
Man transported from Alternate World into ours by a Neutrino Detector
How to access asp.net controls from DNN skin code behind
The Next CEO of Stack OverflowHow do you create a dropdownlist from an enum in ASP.NET MVC?Placing code behind for a DNN pageASP.NET making a user controlled template with WebControls in themHow to access HTML control in C# code behind without “runat=server”?How to Export Gridview Data in Pdf in DotNetNuke(DNN)?How to find a client side element in an update panel from code behind?Writing this HTML Control in ASP.NETHow to do Code Behind for a User Control FileHow to set Chart control width into percentageUnable to create a User Control Module for ASP.NET controls in DNN 8
I'm working on a DNN skin using Christoc's DNN templates and when I create a normal ASP.NET control on my home.ascx file, I'm unable to reference it in the code behind.
I know that on normal web projects, the aspx.designer.cs file controls all that but I don't know how to generate one for a .ascx file or if that's even how it should work in a DNN skin.
How do I reference an ASP.NET control from the code behind in a DNN skin template?
Here's the control I'm trying to access:
<asp:HyperLink ID="hlAccountSettings" runat="server">My Account</asp:HyperLink>
And the code behind:
namespace Company.Modules.CompanySkin2019
public partial class Home : SkinBase
protected override void OnLoad(EventArgs e)
base.OnLoad(e);
UserInfo currUserInfo = UserController.Instance.GetCurrentUserInfo();
hlAccountSettings.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Profile", "userId=" + currUserInfo.UserID, "pageno=1");
// ^ ERROR: The name 'hlAccountSettings' does not exist in the current context
c# asp.net dotnetnuke
add a comment |
I'm working on a DNN skin using Christoc's DNN templates and when I create a normal ASP.NET control on my home.ascx file, I'm unable to reference it in the code behind.
I know that on normal web projects, the aspx.designer.cs file controls all that but I don't know how to generate one for a .ascx file or if that's even how it should work in a DNN skin.
How do I reference an ASP.NET control from the code behind in a DNN skin template?
Here's the control I'm trying to access:
<asp:HyperLink ID="hlAccountSettings" runat="server">My Account</asp:HyperLink>
And the code behind:
namespace Company.Modules.CompanySkin2019
public partial class Home : SkinBase
protected override void OnLoad(EventArgs e)
base.OnLoad(e);
UserInfo currUserInfo = UserController.Instance.GetCurrentUserInfo();
hlAccountSettings.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Profile", "userId=" + currUserInfo.UserID, "pageno=1");
// ^ ERROR: The name 'hlAccountSettings' does not exist in the current context
c# asp.net dotnetnuke
add a comment |
I'm working on a DNN skin using Christoc's DNN templates and when I create a normal ASP.NET control on my home.ascx file, I'm unable to reference it in the code behind.
I know that on normal web projects, the aspx.designer.cs file controls all that but I don't know how to generate one for a .ascx file or if that's even how it should work in a DNN skin.
How do I reference an ASP.NET control from the code behind in a DNN skin template?
Here's the control I'm trying to access:
<asp:HyperLink ID="hlAccountSettings" runat="server">My Account</asp:HyperLink>
And the code behind:
namespace Company.Modules.CompanySkin2019
public partial class Home : SkinBase
protected override void OnLoad(EventArgs e)
base.OnLoad(e);
UserInfo currUserInfo = UserController.Instance.GetCurrentUserInfo();
hlAccountSettings.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Profile", "userId=" + currUserInfo.UserID, "pageno=1");
// ^ ERROR: The name 'hlAccountSettings' does not exist in the current context
c# asp.net dotnetnuke
I'm working on a DNN skin using Christoc's DNN templates and when I create a normal ASP.NET control on my home.ascx file, I'm unable to reference it in the code behind.
I know that on normal web projects, the aspx.designer.cs file controls all that but I don't know how to generate one for a .ascx file or if that's even how it should work in a DNN skin.
How do I reference an ASP.NET control from the code behind in a DNN skin template?
Here's the control I'm trying to access:
<asp:HyperLink ID="hlAccountSettings" runat="server">My Account</asp:HyperLink>
And the code behind:
namespace Company.Modules.CompanySkin2019
public partial class Home : SkinBase
protected override void OnLoad(EventArgs e)
base.OnLoad(e);
UserInfo currUserInfo = UserController.Instance.GetCurrentUserInfo();
hlAccountSettings.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Profile", "userId=" + currUserInfo.UserID, "pageno=1");
// ^ ERROR: The name 'hlAccountSettings' does not exist in the current context
c# asp.net dotnetnuke
c# asp.net dotnetnuke
asked Mar 21 at 19:28
TheIronCheekTheIronCheek
4691520
4691520
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In our case, we create a user control like:
<div class="checkbox">
<label>
<asp:CheckBox ID="changeForAll" runat="server" OnCheckedChanged="changeForAll_OnCheckedChanged" Text="Apply changes for all devices" Checked="True" AutoPostBack="true" />
</label>
</div>
And the code behind:
public partial class ChangeForAllCheckbox : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
changeForAll.Checked = ...;
protected void changeForAll_OnCheckedChanged(object sender, EventArgs e)
[...]
add a comment |
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55287990%2fhow-to-access-asp-net-controls-from-dnn-skin-code-behind%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In our case, we create a user control like:
<div class="checkbox">
<label>
<asp:CheckBox ID="changeForAll" runat="server" OnCheckedChanged="changeForAll_OnCheckedChanged" Text="Apply changes for all devices" Checked="True" AutoPostBack="true" />
</label>
</div>
And the code behind:
public partial class ChangeForAllCheckbox : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
changeForAll.Checked = ...;
protected void changeForAll_OnCheckedChanged(object sender, EventArgs e)
[...]
add a comment |
In our case, we create a user control like:
<div class="checkbox">
<label>
<asp:CheckBox ID="changeForAll" runat="server" OnCheckedChanged="changeForAll_OnCheckedChanged" Text="Apply changes for all devices" Checked="True" AutoPostBack="true" />
</label>
</div>
And the code behind:
public partial class ChangeForAllCheckbox : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
changeForAll.Checked = ...;
protected void changeForAll_OnCheckedChanged(object sender, EventArgs e)
[...]
add a comment |
In our case, we create a user control like:
<div class="checkbox">
<label>
<asp:CheckBox ID="changeForAll" runat="server" OnCheckedChanged="changeForAll_OnCheckedChanged" Text="Apply changes for all devices" Checked="True" AutoPostBack="true" />
</label>
</div>
And the code behind:
public partial class ChangeForAllCheckbox : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
changeForAll.Checked = ...;
protected void changeForAll_OnCheckedChanged(object sender, EventArgs e)
[...]
In our case, we create a user control like:
<div class="checkbox">
<label>
<asp:CheckBox ID="changeForAll" runat="server" OnCheckedChanged="changeForAll_OnCheckedChanged" Text="Apply changes for all devices" Checked="True" AutoPostBack="true" />
</label>
</div>
And the code behind:
public partial class ChangeForAllCheckbox : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
changeForAll.Checked = ...;
protected void changeForAll_OnCheckedChanged(object sender, EventArgs e)
[...]
answered Mar 22 at 13:30
Erick Langford XenesErick Langford Xenes
93111023
93111023
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55287990%2fhow-to-access-asp-net-controls-from-dnn-skin-code-behind%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
