asp.net-controls

How do I disable all controls in ASP.NET page?

I have multiple dropdownlist in a page and would like to disable all if user selects a checkbox which reads disable all. So far I have this code and it is not working. Any suggestions? foreach (Control c in this.Page.Controls) { if (c is DropDownList) ((DropDownList)(c)).Enabled = false; } ...

Is there a way to put inner controls inside a ASP.NET Custom Control?

I want to do something like (Updated example): <uc:Tabs> <Tab Name="A handy tab"> <Node Url="~/Default.aspx" /> <Node Url="~/Node2.aspx" /> </Tab> <Tab Name="Another handy tab"> <Node Url="~/Neato.aspx" /> <Node Url="~/Node3.aspx" /> <Node Url="~/Node4.aspx" /> </Tab> <uc:Tabs> Possible? Any tutorial...

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

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> </T...

Is there a way to programmatically set the current node of a SiteMapPath control?

My site has a few pages that point to the same child page. I'm using a xml site map that will not allow me to duplicate a SiteMapNode with the same Url. My idea was then to give my SiteMapPath control a parent node to populate itself from, and then add on a SiteMapNode of the current page. Has anyone else had to do something similar? ...

Adding 'onClientClick' javascript to an ASP.NET Login control

I've got to put a login page from a 3rd party website in an iframe on another website that I'm developing. I need to add some JavaScript to break out of the iframe when the user logs in, but I can't make the login button to execute the JavaScript and do the postback for the login - just one or the other. Here's the code from the iframe'...

Better performance: OnDataBound or iterate on PreRender

I have a menu where I am setting the selected value dynamically. Will I have better performance doing setting the value on a DataBound event or iterating over the menu in the PreRender event? Would the performance characteristics be generalizable to all data bound controls (i.e. would it be different for a menu versus a gridview)? F...

Third Party Controls for Address Input

Can anyone recommend a third party control for an ASP.NET site that supports the entry and validation of address information for multiple countries? For instance, when "USA" is selected as the country a text/combo box for "State" is displayed/enabled and required, where as it's hidden/disabled and not required when "Canada" or other co...

Increase the Width of a Dropdown List

How can I increase the width of a DropDownList in ASP.NET? ...

Is there anyway to override how the ASP.NET TreeNode Control's renders itself?

What I am trying to do is change the TreeView into a table tree view, an expandable tree that contains cells for other related data per each node. The problem is I have not found anyway to hack around the "internal Render" method of the TreeNode object (it's not a Control) or the protected internal RenderContents of the calling TreeView...

ASP.NET how to create container control which will have exactly two containers?

How to create a web control which will contain exactly two containers in ASP.NET 3.5. Like always exactly two columns (divs). I know default way allows you to have ControlCollection by overriding CreateControlCollection() method, but whis allows you to have only one container (or variable number of containers). Is there a way to always h...

ASP.NET custom templates, still ASP.NET controls possible?

Hello: we currently do not use asp.net controls (no web forms). The way we do is: 1> Read HTML file from disk 2> lookup database, parse tags and populate data finally, Response.Write(page.ToString()); here there is no possibility of using asp.net controls. What I am wondering is, if we use asp.net controls in those HTML files, is the...

How to reduce this IF-Else ladder in c#

This is the IF -Else ladder which I have created to focus first visible control on my form.According to the requirement any control can be hidden on the form.So i had to find first visible control and focus it. if (ddlTranscriptionMethod.Visible) { ddlTranscriptionMethod.Focus(); } else if (ddlSpeechRecognition.Visi...

How to access a nested MultiView control in ASP.NET

I have an asp.net page with a multiview control nested within another multiview control. In my code behind I'm trying to access the inner most multiview control to set it's ActiveViewIndex. The problem I'm having is that I don't seem to be able to access the control. It's not available directly via this.MySubMultiview. And attempts to us...

Maintain Added List Item while binding from datasource

Hi, I have a drop down list, and I added some items in it as follows <asp:DropDownList ID="ddlInsAuther" runat="server" DataSourceID="ObjectDataSourceInsAuthers" DataTextField="AutherName" DataValueField="AutherID"> <asp:ListItem Value="-1">No Authers</asp:ListItem> </asp:DropDownList> ...

Adding a GridViewRowCollection to the asp.net GridView

i have a record of a gridviewrowcollection. and i'm having issues with adding them to the grid. GridViewRowCollection dr = new GridViewRowCollection(list); StatisticsGrid.DataSource = dr; doesnt work. StatisticsGrid.Rows does have an add method, what is strange how can i add a gridviewrowcollection without creating a datatable + b...

asp.net grid color setting

I have a gridview that is bind to the datatable. how to programmaticaly change the color of the 1-st column, after the binding has been done? ...

asp.net validator control issue

I have a validator that check an input. i what that the validator displayed "valid" if the value is valid, and "invalid" if the value is hasnt passed the validation. can i manage this without adding an addional lable for the valid state(by setting the visibility: true/false)? does the validator control has am alternative value, or i ha...

control inside Wizard <StepNavigationTemplate> tag isn't available in code-behind?

I put a Literal control in the tag in the Wizard control. In the codebehind, I can't access that control. Why is that? ...

How to get HTML code of a .NET control

Hello all , I have a .net panel, and I want to send this panel via outlook to other recipients. For this I think I have to find the html code of this element. How to do that ? Thanks. ...

ASP.NET: explicit vs implicit localization?

To my mind the advantage of implicit localization over explicit localization is that if you have more than one property to localize for a given control, it's a more economical syntax. In the case where you just need to localize some text I use the asp:Localize control which only has a single property (Text) that renders to the UI. Is t...