webcontrols

txtFirstName vs FirstNameTxt

Over the past several years I have been using the naming convention of FirstNameTxt when I'm referring to a TextBox Control for a 'First Name' field. However, I've noticed the majority of other developers tend to use the naming convention txtFirstName Which is the best convention to use? ...

accessing web user controls (their id's) from code behind of a user control item

I created a user control in Asp.Net which I populate with <asp:Table id = "...." /> this table has columns that contain dropdownlists, textfields and other web controls... In the code behind I am not able to access these web controls, is there a way I can access them.......or I shouldn't be doing that in the code behind of the user cont...

WebControl development: how do I allow content in a webcontrol that subclasses a control that doesn't?

I'm subclassing (among others) System.Web.UI.WebControls.RadioButton. I want to allow child tags for configuration, like so: <my:RadioPlus runat="server"> <option attr1="something" attr2="somethingelse"/> <option attr1="something2" attr2="somethingelse2"/> </my:RadioPlus> The RadioPlus class is decorated with [ParseChildren(t...

Gridview binding with combobox's in header

Hi all, Could anyone please enlighten me about how one might go about binding to a gridview in ASP.Net 4 in a scenario where the first row of my gridview should be the headers, the second should be a combobox for each column and the third is the beginning of my actual datasource. If you can imagine what I am trying to achieve is an abi...

Register stylesheet from web control on page with UpdatePanel

What is the best method to register a stylesheet once on a page from a customer web control? Please keep in mind that the page uses an UpdatePanel for async calls. I tried just putting the <link> tag in ScriptManager.RegisterClientScriptBlock(), but I get this error: The script tag registered for type 'MyControl' and key 'MyKey' ...

Creating a clicked event on ascx control when pressed

Hello! I have a question about creating and managing events inside an ascx custom web control. I have created a very stupid control consisting in a div containing a asp:Label control, it is a very simple structure: <div id="mydiv" runat="server"> <asp:Label id="mylabel" text="Text"... /> </div> That is, very simple. I would like...

How can I modify value of SharePoing.WebControls before it is rendered.?

Is there any way allow I can modify value of SharePoing.WebControls before it is rendered.? ...

C# WebBrowser control with uninstalled IE (?)

Hi! I want to use WebBrowser control to load some localfile html page. I am aware that WebBrowser is just a wrapper around the InternetExplorer. As I remember Microsoft allowed users in Vista (?) to "uninstall" the InternetExplorer... The question is: Does WebBrowser runs smoothly with InternetExplorer uninstalled ? Does this uninstall ...

Use c# expression to define server tag property value

Hi, Is it possible to set the property of a server tag from a c# expression, i.e. something like <asp:TextBox Width='<%= [some c# expression] %>'/> ? I though this would be pretty straightforward, but I can't get such an expression to run. Thanks for any help Ryan ...

Which is the best FREE DNN Chat Module

Because the official dnn chat module is very outdated ...

Web User Control with content inside it

Usage : <uc1:WindowControl ID="Window_ExpoNews" runat="server" Height="265px" Title="Expo News" Width="100%"> <ContentTemplate> This content will show in the center cell of this user control. <br /> I can even add real controls. <asp:TextBox ID="TextBox1" runat="server" /> ...

Refreshing an iFrame in a Web Browser Control

C# Visual Studio 2010 I have a complex webpage that contains several iframes that I am loading into a web browser control. I'm trying to figure out a way to refresh one of the iframes when a user clicks a button on the windows form. I can't find anything specific to refreshing a single iframe. Any ideas? ...

HtmlGenericControl and id

Hello, It's there a way i can control the ID of my HtmlGenericControl. I try to create my own HtmlGenericControl and override UniqueID, ClientID, onPreRender etc ... but nothing work ...

How can I replicate If...Then logic as a Web control?

I have a designer working at the ASPX level. He doesn't do C#, doesn't do code-behinds, doesn't compile, etc. He's a pure designer, working with HTML and server controls. I need a conditional control -- an If...Then-ish type thing. Normally, I would do this: <asp:Placeholder Visible='<%# DateTime.Now.Day == 1 %>' runat="server"> I...

Controls null when using a UserControl between projects

TL;DR: All controls within a usercontrol that's being used outside it's home project are null when that usercontrol's Page_Init/Page_Load methods are called. The setup is like this: Projects "UI.Frontend", "UI.ControlPanel", and "UI.Common" are "ASP.NET Web Application"s. UI.Common is never meant to be accessed directly- it just conta...

Does each webcontrol have only one unique event not inherited from System.Web.UI.WebControls?

The reason I want to know this is because it seems that __doPostBack('controlId','eventarg') raises the unique event of the control specified, but I wonder what would happen if the control had multiple unique events. ...

Trouble with FindControl and dynamicly created controls

Example code: var div = new HtmlGenericControl("div"); div.Controls.Add(new Literal() { ID = "litSomeLit" }); var lit = (Literal)div.FindControl("litSomeLit"); Assert.IsNotNull(lit); This code fails the assert, because lit is null. Debugging shows that div.Controls definitely contains a literal with ID of "litSomeLit....

ASP.NET: How can you add a custom/namespaced XHTML attribute to a web control declaratively?

Normally, unknown attributes of a webcontrol are passed through to to the rendered element in the browser. So the following works. <asp:label runat="server" Text="Label Text" helpId="101" /> However, if you use a namespaced attribute like the following <asp:label runat="server" Text="Label Text" myNs:helpId="101" /></div> The att...

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

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

default value in asp.net server control

I have a problem with the default value attribute. When I add my control to page at design mode, default value does not work. This is my code: [DefaultProperty("Text")] [ToolboxData("<{0}:KHTLabel runat=server key=dfd></{0}:KHTLabel>")] public class KHTLabel : Label ,IKHTBaseControl { [Bindable(true)] [Category("Appearance")] ...