web-controls

Validate - Web User Control

喜你入骨 提交于 2019-12-30 14:46:48
问题 I do not like to use the calendar from .NET, so I would like to have one Web User Control with 3 drop down boxes, day, month, year. [CODE DONE] . I want to be able to call this Control and initialize it with start year and end year, and with or without selected date. [CODE DONE] . This control will see if there is one valid date selected and return bool [CODE DONE] . Then in my web page I would like to able to see if that web user control is valid, in a way that I can use with the normal .NET

Using linq to get list of web controls of certain type in a web page

瘦欲@ 提交于 2019-12-29 08:07:34
问题 Is there a way to use linq to get a list of textboxes in a web page regardless of their position in the tree hierarchy or containers. So instead of looping through the ControlCollection of each container to find the textboxes, do the same thing in linq, maybe in a single linq statement? 回答1: One technique I've seen is to create an extension method on ControlCollection that returns an IEnumerable ... something like this: public static IEnumerable<Control> FindAll(this ControlCollection

When creating a web control should you override OnLoad or implement Page_Load

不打扰是莪最后的温柔 提交于 2019-12-29 07:34:52
问题 When you create a new web user control in visual studio it by default adds the Page_Load event. What is the advantage to using this rather than overriding the base OnLoad event on the control? Is it just that the Page_Load event fires before OnLoad ? 回答1: The OnLoad method should be the place where the Load event is raised. I personally always try to handle the event unless I need to do extra processing around raising the event. I recommend handling the event itself under normal circumstances

How to retrieve a TextBox from DetailsView - ASP.NET

帅比萌擦擦* 提交于 2019-12-25 04:49:09
问题 I have a DetailsView Control, inside as a template a TextBox. I need to find out the value for a TextBox when Inserting data Event handler-, _ItemInserting. The script does not work. Ant ideas?? Thanks -------------------- WEB FORM <asp:TemplateField HeaderText="Profile" SortExpression="ContentAuthor"> <ItemTemplate> <asp:Label ID="uxContentAuthorDisplayer" runat="server" Text='<%# Bind("ContentAuthor") %>'></asp:Label> </ItemTemplate> <InsertItemTemplate> <asp:TextBox ID=

Dynamically Generated DropDownList web controls hides on selected

丶灬走出姿态 提交于 2019-12-25 02:58:39
问题 I am facing troubles in creation of dynamic web controls. I have a SQL Databounded DropDownlist with DataTextField ="All_Columns" and DataValueField="DATA_TYPE". Upon DropDownList1_SelectedIndexChanged i must check for the datatype as decimal or Varchar for the Selected value. If it is decimal i must call Createdynamicwebcontrols_decimal() and create DropDownList2. If it is varchar i must call Createdynamicwebcontrols_varchar(). Current Issue: Upon DropDownList2_SelectedIndexChanged i must

How do I create form controls dynamically with DHTML and deal all those with JSF?

谁说胖子不能爱 提交于 2019-12-24 17:53:27
问题 Suppose this next situation: making a view where the form controls are rendered with DHTML (that is, each time the user press a button, a new row with fields is created and field identifiers are both generated and asigned to the fields with the same DHTML as 'form1control1' and so on), but where that controls are not related yet to any UIComponent in the ViewRoot (as they are created dynamically by the client and so the server don't know they are in the form) How can I deal with a) finding

ASP CompositeControl & ScriptManager

房东的猫 提交于 2019-12-24 10:36:26
问题 I'm really new to the WebControl / CompositeControl world, and I have a small test class I am playing with. It's just a LinkButton that updates when clicked. Things work great when I leave it out of UpdatePanel . But when I try to run it inside I still get a full page POST response. How can I make this class work inside a UpdatePanel ? Here's the class: public class Test2 : CompositeControl { private static readonly object testButtonEvent = new object(); public event EventHandler OnTestClick

Sharing value from child to parent control

谁都会走 提交于 2019-12-23 13:31:58
问题 I am relatively new to this, but here is my problem. In asp.net, I have a parent and a child control. Within the child control I have a dropdown list. Based on dropdown list's selected value I would like to toggle Visibility of Panel in parent control. For instance if I select Show in child control dropdown list, I need to pass true to parent control to make Panel visible and vice versa. How should I do that. I have read that can be done via the event handling and have seen certain scenarios

Free asp.net color picker control

好久不见. 提交于 2019-12-22 04:38:22
问题 Can anyone recommend a free color picker web control for asp.net webforms ? Thanks 回答1: It's not supported by every browser yet, but you could use the HTML 5 color input: <input type="color" name="favcolor" value="#ff0000"> 回答2: Use any number of jQuery plugins to populate a textbox. Here's two: Farbtastic ColorPicker 回答3: This one is nice: http://www.karpach.com/ColorPickerDemo.aspx 回答4: @Html.EditorFor(model => model.Color, new { htmlAttributes = new { @class = "form-control", required =

Why don't all System.Web.UI.WebControl classes with Text properties implement ITextControl?

时光总嘲笑我的痴心妄想 提交于 2019-12-21 03:50:06
问题 I'm curious why only some System.Web.UI.WebControl controls implement certain interfaces when they have the same properties of an interface. For instance, there are plenty of controls that have a Text property but only the following implement ITextControl : Label Literal DataBoundLiteral TextBox ListControl (TextBox and ListControl actually implement IEditableTextControl which implements ITextControl) TableCell, Button, HyperLink and others don't so I have to write code like this ITextControl