ascx

Retrieve SharePoint List Data and bind this to a dropdownlist

我的梦境 提交于 2019-11-30 21:59:29
I'm fairly new to SharePoint so apologies in advance for sounding like a 'Newbie'. I have created a simple Webpart, which uses a Web User Control - [ .ascx file] to provide all the controls for the Webpart. On the .ascx file, there is a DropDownList which is hard-coded at the moment and works well in the Webpart (within a SharePoint site). However, I want the DropDownList on the .ascx file to be bound to a particular Column of a SharePoint List, so that when I update that column of the SharePoint List, the DropDownList reflects the update automatically. Do any of you kind folk have any ideas

MVC3 Razor: Is it Possible to Render a Legacy ASCX?

泪湿孤枕 提交于 2019-11-30 18:11:06
With the Razor view engine in MVC3, Is it possible to render a legacy ascx? I was expecting to be able to do something like: @Html.RenderPartial("Footer.ascx") Yes. Try this instead: @Html.Partial("Footer") or @{ Html.RenderPartial("Footer"); } Just wanted to add that I haven't seen a lot of people posting this solution: Html.RenderAction("Footer", "Home"); This is better practise if you are using MVC, because you can specify any data you need in the controller instead of trying to manage it in a free-floating partial view. Very beneficial if you use a BaseController class to initialize all

Retrieve SharePoint List Data and bind this to a dropdownlist

不想你离开。 提交于 2019-11-30 17:33:59
问题 I'm fairly new to SharePoint so apologies in advance for sounding like a 'Newbie'. I have created a simple Webpart, which uses a Web User Control - [ .ascx file] to provide all the controls for the Webpart. On the .ascx file, there is a DropDownList which is hard-coded at the moment and works well in the Webpart (within a SharePoint site). However, I want the DropDownList on the .ascx file to be bound to a particular Column of a SharePoint List, so that when I update that column of the

MVC3 Razor: Is it Possible to Render a Legacy ASCX?

随声附和 提交于 2019-11-30 03:06:47
问题 With the Razor view engine in MVC3, Is it possible to render a legacy ascx? I was expecting to be able to do something like: @Html.RenderPartial("Footer.ascx") 回答1: Yes. Try this instead: @Html.Partial("Footer") or @{ Html.RenderPartial("Footer"); } 回答2: Just wanted to add that I haven't seen a lot of people posting this solution: Html.RenderAction("Footer", "Home"); This is better practise if you are using MVC, because you can specify any data you need in the controller instead of trying to

Can a Web User Control (.ascx) use a CSS file for styling?

感情迁移 提交于 2019-11-29 16:23:22
Here's the source of a blank .acsx file I created called LogOnBox. <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LogOnBox.ascx.cs" Inherits="ECommerce.Views.Shared.LogOnBox" %> I want to drag some labels, and textboxes etc and give them style using a CSS file. How can I associate a CSS to an acsx file? The CSS is associated to the page, and not the control specifically. But you can use the CSS in the control when the page has referenced it. Just reference the css file in the header of the page containing the user control. In my cases i would like to embed css and js file into

How to call an ASP.NET WebMethod in a UserControl (.ascx)

拟墨画扇 提交于 2019-11-28 22:24:57
Is it possible to place a WebMethod in an ascx.cs file (for a UserControl) and then call it from client-side jQuery code? For some reasons I can't place the WebMethod code in an .asmx or .aspx file. Example: In ArticleList.ascx.cs I have the following code: [WebMethod] public static string HelloWorld() { return "helloWorld"; } In ArticleList.ascx file there I have the call to the WebMethod as follows: $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", data: "{}", dataFilter: function(data)//makes it work with 2.0 or 3.5 .net { var msg; if (typeof (JSON) !== 'undefined' &&

Property null after postback - Dynamically loaded control

[亡魂溺海] 提交于 2019-11-28 11:24:36
I'm aware this question has been asked many times before but I suspect I have a unique scenario. I'm loading a Child Control (ASCX) and setting a Property on that Control. This works perfectly fine until postback where the property is null. Herewith the First Class which loads the ChildControl : protected override void CreateChildControls() { MyUserControl control = (MyUserControl)Page.LoadControl(_ascxPath); control.MyProperty = base.MyProperty Controls.Add(control); } Then, on my Child Control I've got the following code: public partial class MyUserControl : UserControl { public MyType

Can a Web User Control (.ascx) use a CSS file for styling?

∥☆過路亽.° 提交于 2019-11-28 10:08:49
问题 Here's the source of a blank .acsx file I created called LogOnBox. <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LogOnBox.ascx.cs" Inherits="ECommerce.Views.Shared.LogOnBox" %> I want to drag some labels, and textboxes etc and give them style using a CSS file. How can I associate a CSS to an acsx file? 回答1: The CSS is associated to the page, and not the control specifically. But you can use the CSS in the control when the page has referenced it. 回答2: Just reference the css file

Pass data from a ASP.NET page to ASCX user controls loaded dynamically

霸气de小男生 提交于 2019-11-28 04:59:24
I'm developing an ASP.NET application with C# and Ajax. I have a page that holds user controls loaded dynamically. I need to pass some data (integer values and some strings) to the user control that has been loaded dynamically . Now I use Session to pass these values, but I think I can use another way; something like VIEWSTATE or hidden input. What do you recommend me? UPDATE: The fact that I load the controls dynamically is important because controls are loaded on every postback, and I can't store any value on controls. Create a property on your user control with the datatype of the data you

Is there a way to use “<%= someObject.ClientID %>” in an external javascript file?

半世苍凉 提交于 2019-11-27 17:51:18
Is there a way to use "<%= someObject.ClientID %>" in an external javascript file? If I use the code <%= someObject.ClientID %> in a script tag inside my as(c/p)x page, it works fine. On the rendered page, the ClientID is resolved. Howvever, if I put in an external JS file and just add: It doesn't. Is there a way to do this or am I stuck with leaving that code in the as(c/p)x file? Side question -- what is the act of doing <%=... %> in your markup file called? This is totally possible. In your presentation layer (your .aspx page), create a script reference to an aspx page that contains your