webcontrols

Multi-select dropdown list in ASP.NET

Do any good multi-select dropdownlist with checkboxes (webcontrol) exist for asp.net? Thanks a lot ...

Passing a particular WebControl type as a parameter in VB.net

I'm trying to create a function that searches up a WebControl's parent-child relationship (basically the opposite of WebControl.FindControl(id as String), but looking for a specific WebControl type). Example: I have a user control in an ItemTemplate for a GridViewRow. I'm trying to reference the GridViewRow from the user control. The ...

Label text in datarepeater

I am trying to use a label in my datarepeater, when I am able to bind data and write to me html page. <asp:Label ID="lblID" runat="server"><%# DataBinder.Eval(Container.DataItem, "ID")%></asp:Label> which works fine. When I try to get text value I get "". Label lblcurrentID = ri.FindControl("lblID") as Label; result: lblcurrentID....

Collapsible Panel in ASP.net

Okay, I think I'm just making a stupid mistake here, but I want to create a Control (derived from System.Web.UI.Control) that is collapsible, using the good ol' ASP.net ViewState/PostBack model. I have an ImageButton in my class, which I initialize in the OnInit() Event: private ImageButton _collapseImage; protected override vo...

Adding attributes to SharePoint Web Control

I'm trying to add an attribute to a SharePoint web control: Microsoft.SharePoint.WebControls.BooleanField which basically renders as an html input checkbox control. How do I add an attribute to this? such as an event? Normally for an asp.net web control, you can just do: sampleControl.Attributes.Add("onclick", "alert('test');"); An...

Changing WebControl ID Inside of a Repeater

<ItemTemplate> <asp:Label runat="server"><%#DataBinder.Eval(Container.DataItem, "Question")%></asp:Label> <asp:DropDownList runat="server" id="<%#DataBinder.Eval(Container.DataItem, "QuestionID")%>">> <asp:ListItem value="1" text="Yes" /> <asp:ListItem value="0" text="No" /> </asp:DropDownList> <ItemTemplate> ...

How do I set controls' values of a repeater control regardless to their data

This is the repeater: <asp:Repeater ID="rptrReports" runat="server"> <ItemTemplate> <div style="margin: 2"> <asp:Label ID="lblAccount" runat="server" Text='<%#Eval("Account").FullName%>' />&nbsp; <asp:TextBox ID="txtDescription" runat="server" MaxLength="256" Text='<%#...

By default, does ASP.NET Login Control use the ReturnURL to redirect?

If I drop a System.Web.UI.WebControls.Login onto a page, should it redirect to the ReturnURL by default? Or do I have to set some config settings or write some code to make this work? ...

Parser error when trying to wrap child controls

I have developed a server control inherited from WebControl that wraps any number of child controls and changes their output. The control class is very simple and only contains the RenderContents method. Here is an example of how it has been placed on the page. (Not included: registration of control namespaces.) The intention here is th...

Render a .NET Web Control from a string?

Is it possible in ASP.NET to dynamically load up a WebControl from a string with some tag contents in it (without writing a bunch of custom code)? For instance, I have a string like the following: string controlTag = "<asp:Label ID=\"lblLabel\" runat=\"server\" />"; I then want to do something like the following to load up the contro...

dynamically change css attribute's value in asp.net

how can i change the css attribute value at runtime like all h1 color="blue" and all p color="green". if anyone know it please help me! ...

Having to call .ClientID to get .ID to populate for a web control

Hi there. I'm making a forms framework for a project, and have found that when trying to programmatically set the AssociatedControlID property of the asp:Label to its associated TextBox, I have to call ClientID to get ID to populate (not be null). While debugging, this use of the intermediate window shows the issue: _inputTextBox.ID n...

Check All Checkboxes

I am trying to check all the checkboxes on a webform (aspx) page, which is inside a master page, depending on the ID of the checkbox. The checkboxes are created dynamically, so I only know the prefix for finding it. So, I need to find these checkboxes by iterating the controls on the page somehow. It's not working out. Any help would ...

ASP.NET WebControls are not appearing in my VS 2008 toolbox

It's been a while since I've created a new ASP.NET web application. (I've been doing ASP.NET MVC for the last 9 months, and hadn't done an ASP.NET site for about a year before that.) Now I've created a new regular ASP.NET app and when I look at the Default.aspx file, Visual Studio is only displaying the HTML tab in the Toolbox. I don't h...

How to stop a web control from loading child controls?

This is for ASP.NET. Think about the multiview control. It has 1 to many view controls. Each view control has the ability of holding controls, but, yet, only one view is visible at a time. Keeping that in mind, I'm thinking I want to "tell" the non-visible views to NOT LOAD, therefore, NOT LOADING the child controls. In my sample, duri...

Best way to globally set every control's ValidationGroup property in an asp.net?

I have a User Control with form items that is re-used considerably throughout a large web application, and up until this point the validation summary upon an invalid form submission is being handled by the .aspx that consumes the User Control. Now I need to set the ValidationGroup property at runtime for each of my form items controls (...

Is there an MVC way of doing ASCX?

Are ASCXs still used in ASP.NET MVC or should we be using something else? ...

Dynamically Adding Web Control to .Aspx page with script blocks

I am trying to add a chart control to my .aspx page, but am getting the following error: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). with this code: protected void Page_Init(object sender, EventArgs e) { if (Context.Items.Contains("ajaxChart")) { ajaxChart = (bool) Cont...

Difference between a WebControl and a CompositeControl?

Hello! I have been looking around on the web and found some articles about the topic, but i still can't figure out the difference between them. I have the code show below, if i inherit from a CompositeControl it works perfectly but not if i inherit from a WebControl. (They both render the code, but only the CompositeControl handles the ...

Building your own web controls

Hi All, well it's kinda a newbie question but i think lots of people have problem with that. I'm developing windows\web application for fun, and install them at friends places. most of my developing concentrates on CRM system. but I've a big problem with Showing data from DB in better, effective, lighter ways. using microsoft built-in we...