Questions tagged [asp.net-controls]

ASP.NET Web server controls are objects on ASP.NET Web pages that run when the page is requested and that render markup to a browser. Many Web server controls resemble familiar HTML elements, such as buttons and text boxes. Other controls encompass complex behavior, such as a calendar controls, and controls that manage data connections.

172 questions
38
votes
6 answers

ASP.NET control to render a

The Label control in ASP.NET seems to render tags, but is there a server control to render HTML within a
? Sure, I could set display: block and it might look the same, but I'd rather not be nesting divs inside spans. Also I'd prefer not…
James
  • 6,911
  • 9
  • 40
  • 80
25
votes
4 answers

How to register custom server control on ASP.NET page

I have a project and I am trying to register a custom server control (there is no .ascx file) on the page. I am currently using Class Declaration namespace MyApp.Controls{ public class CustomControl: WebControl{ public string Text …
21
votes
9 answers

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…
Mohamed
  • 3,092
  • 7
  • 25
  • 31
17
votes
1 answer

Obtain strongly typed header class in ASP.NET Core

How do you obtain a strongly typed header class from the namespace System.Net.Http.Headers from an ASP.NET Core controller? In a controller derived from Controller, Request.Headers is available, but it just returns IHeaderDictionary. There is also…
Edward Brey
  • 35,877
  • 14
  • 173
  • 224
11
votes
2 answers

PlaceHolder vs Literal for adding HTML markup generated at runtime

This question points out Literal vs Label while this question points out Panel VS. PlaceHolder but just today I was debating with my colleague on using PlacHolder vs Literal for adding HTML markup which is generated at runtime. Both controls do not…
Ahmed Atia
  • 17,223
  • 24
  • 88
  • 129
9
votes
3 answers

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

I want to do something like (Updated example):
rball
  • 6,796
  • 7
  • 45
  • 74
9
votes
7 answers

Set ClientID in asp.net

Is it possible to set the ClientID of any asp.net server control? How can I do this?
ebattulga
  • 9,573
  • 19
  • 76
  • 111
7
votes
5 answers

How can I create a custom Repeater that displays Header, Footer based on properties?

I want to create a Repeater that displays the header/footer based on properties, only if the DataSource is empty. public class Repeater : System.Web.UI.WebControls.Repeater { public bool ShowHeaderOnEmpty { get; set; } public bool…
BrunoLM
  • 88,362
  • 76
  • 272
  • 427
6
votes
2 answers

ASP.Net ListView Grouping by Data Field?

I uses asp.net listview control to display the details. Each item has the group details. For demo purposes group is hard coded. I want to display the listview as shown below Right now, I have this Code:
Karthikeyan Vijayakumar
  • 2,347
  • 2
  • 19
  • 33
6
votes
2 answers

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…
User
  • 49,320
  • 65
  • 164
  • 234
5
votes
2 answers

How to add control to the page programatically in page load?

I am trying to add controls to the page from the code behind in the page load stage like this: foreach (FileInfo fi in dirInfo.GetFiles()) { HyperLink hl = new HyperLink(); hl.ID = "Hyperlink" + i++; hl.Text = fi.Name; hl.NavigateUrl…
Laziale
  • 7,259
  • 39
  • 131
  • 229
5
votes
10 answers

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) …
Rohit Raghuvansi
  • 2,724
  • 8
  • 41
  • 70
4
votes
3 answers

Add ASP Controls to a Table Dynamically

Right now I have an ASP Table. I can add rows and cells to this table just fine. What I would like to do, is instead of the cell just displaying text, I would like to add a control. For example a Button. Right now, my first thought on how to do this…
user489041
  • 26,050
  • 52
  • 126
  • 198
4
votes
4 answers

ASP.NET Server Control Property Attribute must be required

I have a custom ASP.NET server control CustomControl with a property attribute Path. If the Path is not explicitly specified, then I want an exception to be thrown. For example,
smartcaveman
  • 38,142
  • 26
  • 119
  • 203
4
votes
5 answers

how to change visible of an asp.net control of master page in content page?

I have a Master Page that have a asp:Panel control and the code that sets Visible = False in it's code behind. Now i want to change Visible = True in one of content page. How do it? Master page code behind: AccountUserInfo.Visible = false; …
Hamid Talebi
  • 1,240
  • 2
  • 22
  • 39
1
2 3
11 12