custom-server-controls

How To: Use AJAX in an ASP.NET Custom Server Control

安稳与你 提交于 2020-01-22 10:07:01
问题 Does anyone know of a good tutorial that demonstrates using an existing AJAX control extender in a Custom ASP.NET Server Control? I do not want to build a "Custom AJAX Server Control". I want to build a Custom Server Control that uses an existing AJAX control extender. I would like to combine an asp:TextBox, asp:ImageButton, asp:CustomValidator (with client side javascript from an embedded resource), and an ajax:CalendarExtender into one custom server control. Or has this already been created

How To: Use AJAX in an ASP.NET Custom Server Control

吃可爱长大的小学妹 提交于 2020-01-22 10:03:07
问题 Does anyone know of a good tutorial that demonstrates using an existing AJAX control extender in a Custom ASP.NET Server Control? I do not want to build a "Custom AJAX Server Control". I want to build a Custom Server Control that uses an existing AJAX control extender. I would like to combine an asp:TextBox, asp:ImageButton, asp:CustomValidator (with client side javascript from an embedded resource), and an ajax:CalendarExtender into one custom server control. Or has this already been created

How To: Use AJAX in an ASP.NET Custom Server Control

我的梦境 提交于 2020-01-22 10:02:08
问题 Does anyone know of a good tutorial that demonstrates using an existing AJAX control extender in a Custom ASP.NET Server Control? I do not want to build a "Custom AJAX Server Control". I want to build a Custom Server Control that uses an existing AJAX control extender. I would like to combine an asp:TextBox, asp:ImageButton, asp:CustomValidator (with client side javascript from an embedded resource), and an ajax:CalendarExtender into one custom server control. Or has this already been created

ASP.NET Custom Control - What is the best way to include embedded CSS reference only once?

亡梦爱人 提交于 2020-01-21 01:41:11
问题 The problem: I am embedding a CSS file into a custom control library with several controls. I want to share the same CSS file for all of the controls regardless of how many instances of them are on a given form. When more than one control is on the form, I would like exactly 1 reference to the CSS file in the HTML header of the ASP.NET page. Here is what I have come up with (so far): Public Sub IncludeStyles(ByVal Page As System.Web.UI.Page) 'Don't include the reference if it already exists..

Create a custom label that implements IPostBackDataHandler

不羁的心 提交于 2020-01-15 16:38:31
问题 I want to create a label that implements the IPostBackDataHandler, because I want to change the text with javascript. If I trigger a postback after that, than my text is gone. The code that I already have is this: public class CustomLabel : Label, IPostBackDataHandler { protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (Page != null) Page.RegisterRequiresPostBack(this); } public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection

Server control behaving oddly

被刻印的时光 ゝ 提交于 2020-01-15 03:13:05
问题 I have a server control that I have written, which generally works fine. However when I add in the highlighted line, it adds in not one but two <br /> elements, which is not what I am after. mounting=new DropDownLabel(); mounting.ID="mountTypeList"; mounting.Attributes.Add("class", "mounting"); mounting.Values=Configuration.MountTypes.GetConfiguration().Options; mounting.Enabled=Utilities.UserType == UserType.Admin; mounting.Value=value.Reference; td1.Controls.Add(mounting); **td1.Controls

ASP.NET inject javascript in user control nested in update panel

[亡魂溺海] 提交于 2020-01-12 03:59:10
问题 I'm trying to load javascript code with a user web control into a page via a the Page.LoadControl method during an asyncron post back of an update panel. I've tried the specially for that scenario designed methods of the scriptmanager, but the javascript just doens't get returned to the user. To explain my scenario a bit better: Master Page has the script manager and one page loads the user control via Page.LoadControl-method during an async post back. The custom control injects in the pre

ASP.NET inject javascript in user control nested in update panel

无人久伴 提交于 2020-01-12 03:58:10
问题 I'm trying to load javascript code with a user web control into a page via a the Page.LoadControl method during an asyncron post back of an update panel. I've tried the specially for that scenario designed methods of the scriptmanager, but the javascript just doens't get returned to the user. To explain my scenario a bit better: Master Page has the script manager and one page loads the user control via Page.LoadControl-method during an async post back. The custom control injects in the pre

How to take control of style sheets in ASP.NET Themes with the StylePlaceHolder and Style control

陌路散爱 提交于 2020-01-10 07:47:41
问题 Update: This turned into a blog post, with updated links and code, over at my blog: https://egilhansen.com/2008/12/01/how-to-take-control-of-style-sheets-in-asp-net-themes-with-the-styleplaceholder-and-style-control/ The problem is pretty simple. When using ASP.NET Themes you do not have much say in how your style sheets are rendered to the page. The render engine adds all the style sheets you have in your themes folder in alphabetic order, using the <link href=”...” notation. We all know the

Dropdownlist control with <optgroup>s for asp.net (webforms)?

随声附和 提交于 2019-12-27 10:53:08
问题 Can anyone recommend a dropdownlist control for asp.net (3.5) that can render option groups? Thanks 回答1: I've used the standard control in the past, and just added a simple ControlAdapter for it that would override the default behavior so it could render <optgroup>s in certain places. This works great even if you have controls that don't need the special behavior, because the additional feature doesn't get in the way. Note that this was for a specific purpose and written in .Net 2.0, so it