web-controls

Easy way to AJAX WebControls

I've got an web application that I'm trying to optimise. Some of the controls are hidden in dialog-style DIVs, so I'd like to have them load in via AJAX only when the user wants to see them. This is fine for controls that are mostly Literal-based (various menus and widgets), but when I have what I call "dirty" controls - ones that writ...

How to pass method name to custom server control in asp.net?

I am working on a Customer Server Control that extends another control. There is no problem with attaching to other controls on the form. in vb.net: Parent.FindControl(TargetControlName) I would like to pass a method to the control in the ASPX markup. for example: <c:MyCustomerControl runat=server InitializeStuffCallback="Initializ...

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

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? ...

LINQ query to WebControl.Controls

I have three TextBox controls on the page <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" OnTextChanged="TextBox_TextChanged" TabIndex="1"> <asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True" OnTextChanged="TextBox_TextChanged" TabIndex="2"> <asp:TextBox ID="TextBox3" runat="server" AutoPostBack="...

When's the absolute latest you can call Page.ClientScript.RegisterClientScriptBlock?

I need to output some JavaScript in a WebControl based on some processing and some properties that the consumer can set, doing it on the load of the page will be to early. When is the latest I can call RegisterClientScriptBlock and still have it output on the page? ...

Dyanamically added control not doing postback

I am overriding a Grid, adding some customer features. One of the features is a drop-down to adjust page size. I am extending the grid using a customer server control, which works great for what I've done so far. Now, however I am having a bit of trouble getting the dynamically added control to do a postback. The javascript to initia...

When extending a asp.net web control, at which event should additional web controls be injected?

I'm trying to avoid a composite control or using and ASCX by extending an existing control. However, I'm having trouble with getting the controls added to the inherited control and keep their view-state/post-back integrity. Whenever I add the controls during pre-render, the controls show up, but the post-back throws a viewstate exception...

Is it possible to add a web user control to a class library?

I'm looking at building some web user controls with an eye toward re-use, but I can't seem to add a Web User Control in my class library in VS2008. Is there a way to work around this problem, or is there a better approach to creating reusable controls? ...

What Happens When You Set A Parent Control's Enabled Property?

I have a container of custom controls each of which have 2 controls in them. One to display when enabled (i.e. a textbox, or checkbox), and a label to display when disabled. I've overloaded Render like so: Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) If Me.Enabled Then _item.Rend...

limit selections in a listbox in vb.net

Hi all, I am creating a web control in vb.net that contains a list box. I know that I am able to choose a selection mode of Single or Multiple, but I am interested in limiting a Multiple selection to a predetermined size. For example preventing a user from selecting more than 3 items. I have tried adding a Validator to the list box, w...

How can a custom ASP.NET control cache data without using the ViewState?

I'm not sure if this is possible in ASP.NET, but here is the problem I have: some of the data lists on my web application are displayed using a GridView; however, because some of these lists can contain a lot of data, they sometime push the page weight up into the several megabyte range due to the ViewState. Since we don't want to requer...

Web control advice for my scenario

Here is my scenario and I would like to ask your opinion on which control is best to use. I am using C#, ASP.net 2.0. I am required to create a structure that resembles a tree. The user will start with something and then will add nodes to it. Every node is a structure by itself, so a user should be presented with an option to create a n...

ASP.NET CheckBoxList DataBinding Question

Is it possible to DataBind an ASP.NET CheckBoxList such that a string value in the data becomes the label of the check box and a bool value checks/unchecks the box? On my asp.net webform I have a CheckBoxList like this: <asp:CheckBoxList runat="server" ID="chkListRoles" DataTextField="UserName" DataValueField="InRole" /> In the code ...

Is it bad to model a web user control as a state machine?

We're designing a web user control, which does some different things. It gets events from inside it or outside it, and the response to these events depend on the state of this control. We're thinking of modeling as a state machine, but we think it might be too geeky or hard for someone else to understand. Do you think this is true? ...

Is is possible to get ASP.NET input controls to act like a basic HTML Form?

ASP.NET has a number of nice features regarding making data input pages: Adding input controls is easy (<asp:...). The system automatically generates member variable for the controls. Post-backs automatically populate the members variable with the returned values. and some not so nice bits post-backs seem to be tied to JavaScript f...

Validate - Web User Control

Hello, 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 s...

Are there any AJAX NON-MODEL message box in ASP.NET Web Control?

I am looking for some popup message / reminder like this and that, in a ready to use control in ASP.NET. PS. For some reasons, I am forced NOT TO WRITE ANY JAVASCRIPT. I can use only Web Controls. ...

Dynamic change of an editor type for ASPxGridView

I have an ASPxGridView from DevExpress fed with data from ObjectDataSource. My data row objects expose properties such ParameterName, ParameterType and ParameterValue. //Properties, constructor and private fields code omitted for clarity public class InputParameterDescription { public string ParameterName; public Type ParameterTy...

How do I create an ASP.NET control that simulates switch/case?

I've got a repeater looping through a list of objects that are of different types. I'd like to render the objects differently depending on their type. For this I need some kind of control (since I want to avoid using the code-behind) that has a behavior similar to a switch/case statement. Basically it could look like this: <xxx:TestType...

Control Adapters with Mobile Device Browser File

Hey all. I am using both the Mobile Device Browser File and a custom .browser file. In the custom .browser file, there are several ControlAdapters registered. I would like to specify in my custom .browser file to use different ControlAdapters if the detected device is mobile (provided the Mobile Device Browser File lists it as mobile)....