custom-server-controls

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

丶灬走出姿态 提交于 2019-12-27 10:53:02
问题 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

access WebControls markable properties in constructor asp net

早过忘川 提交于 2019-12-23 10:49:09
问题 Here is my custom control.It inherits [Height] property from WebControl class.I want to access it in constructor for calculating other properties.But its value is always 0.Any idea? public class MyControl : WebControl, IScriptControl { public MyControl() { AnotherProperty = Calculate(Height); ....... } my aspx <hp:MyControl Height = "31px" .... /> 回答1: Markup values are not available in your control's constructor but they are available from within your control's OnInit event. protected

jQuery version conflict resolution with ASP.NET Server Control

天涯浪子 提交于 2019-12-23 06:31:13
问题 I am developing an ASP.NET server control that uses jQuery for some client side logic. I have embedded the jQuery file as a resource inside the control. I don't want to restrict the application using the control to that specific version of jQuery and I want to keep using the version of jQuery that I have embedded. I know about the noconflict method but the problem that i see with that is that i have no control over the order of the script tags on the page. If the user's version of jQuery is

ASP.net weekly schedule control

a 夏天 提交于 2019-12-22 10:55:35
问题 Can anyone recommend a free asp.net control that I can use for the following: Weekdays Monday-Saturday along the top row Time of day along left hand side Template fields for the actual data Databindable Cells span the rows based on the start time and end time Here is a control that I found that is pretty good, but I am trying to find alternatives: Databound Schedule controls 回答1: DayPilot is a pretty good general purpose calendaring/schedule control. The full version is not free, but there is

HTML 'name' attribute generated for ASP.net child controls, instead of the unique 'ID' attribute

北慕城南 提交于 2019-12-20 04:09:25
问题 The generated HTML code for my custom ASP.net server control generates the name attribute for child controls, instead of the id attribute. Something like this : <span id="GridView2_ctl02_editdis"> <input type="text" name="GridView2$ctl02$editdis$ctl00"/> </span> The ID for the custom control itself is apparently proper. What is even stranger for me, is that the ID does get generated sometimes (I do not know under what conditions). But a FindControl() with that ID returns null on the server

How to register custom server control on ASP.NET page

你。 提交于 2019-12-18 12:54:06
问题 I have a project and I am trying to register a custom server control (there is no .ascx file) on the page. I am currently using Class Declaration namespace MyApp.Controls{ public class CustomControl: WebControl{ public string Text { get { String s = (String)ViewState["Text"]; return ((s == null) ? String.Empty : s); } set { ViewState["Text"] = value; } } protected override void RenderContents(HtmlTextWriter output) { output.Write(Text); } } } On my page, <%@ Register TagPrefix="myControls"

writing out the data for each row in custom gridview control and adding insert row at the bottom using IEnumerable

帅比萌擦擦* 提交于 2019-12-13 20:43:00
问题 Im have a problem with writing out the data in my if statement where if(numRows > 0) the code is suppose to create an insert row at the bottom of the grid. It wrties out the insert row with textboxes but it doesn't display my data so i probably need to iterate the datasource and add the data to the appropriate cells which i don't know how. so if someone knows what todo and is able to help that would be appreciated sample code will help. thanks public class CustomGridView : GridView {

How to persist List<T> property in ASP.NET Custom Control?

那年仲夏 提交于 2019-12-12 08:53:18
问题 I have the following property in a custom control: List<myClass> _items; public List<myClass> Items{ get { return _items; } set { _items= value; } } In my codebehind, I add items to the collection as in... myCustomControl.items.Add(new myClass()); However, these are not persisted across postbacks. What is the proper way to allow persistance in custom controls? 回答1: Yikes! Don't put a List<> into the ViewState! It'll be massive! If you add a List<string> that contains two elements - "abc" and

Whats the best way to programatically add a .swf to an asp.net page?

落花浮王杯 提交于 2019-12-11 16:13:39
问题 Is there a good way to add a .swf programatically to a panel on an asp.net page - ie: I know i could just insert the html tags: ie: <object type="application/x-shockwave-flash" data="yourflash.swf" width="" height=""> <param name="movie" value="yourflash.swf"> </object> But is there an existing .net or free FLASH component already that you just set the properties on, or do i need to create a custom web control myself (not preferred) so i dont have to continously do this? Thank you. 回答1:

Possible to have a inner control on a custom server control?

一世执手 提交于 2019-12-11 07:49:40
问题 I would like to be able to do something like: <ui:Tab Title="A nice title"> <TabTemplate> <asp:Literal runat="server" ID="SetMe">With Text or Something</asp:Literal> </TabTemplate> </ui:Tab> but also be able to do: <ui:Tab Title="A nice title"> <TabTemplate> <asp:DataList runat="server" ID="BindMe"></asp:DataList> </TabTemplate> </ui:Tab> Answer code I eventually came up with: [ParseChildren(true)] public class Node : SiteMapNodeBaseControl, INamingContainer { private ITemplate tabTemplate;