Questions tagged [runatserver]

runat="server" is an attribute set to asp.net controls to signalize the server that this should be accessible at server side, by being available as an object at pages code-behind.

runat="server" is a attribute in ASP.NET controls, that indicates that the element should be treated as a server control. The Id attribute is added to identify the server control. The Id reference can be used to manipulate the server control at run time.

108 questions
207
votes
14 answers

Why does ASP.NET webforms need the Runat="Server" attribute?

Why do I have to specify runat="server" on all my ASP.NET controls when it is a mandatory attribute and server is the only option available in my limited knowledge of ASP.NET, and I get an error if I don't use it? I do understand that I can…
johnc
  • 36,657
  • 37
  • 96
  • 137
78
votes
10 answers

ASP.Net Master Page and File path issues

I'm trying to add a script reference to jQuery in my master page so that it will work for any page. It currently looks like this The problem is that the path is always relative to the…
TheDude
  • 1,162
  • 2
  • 10
  • 14
18
votes
4 answers

What is the status of runat="server" tags in ASP.NET MVC?

Some texts on ASP.NET MVC state that "there are no runat server tags", even this MSDN article says this, when, right above that statement there is a code example with a runat server tag in the HEAD…
Edward Tanguay
  • 176,854
  • 291
  • 683
  • 1,015
16
votes
5 answers

How can I use runat="server" on a script tag in asp.Net

I don't necessarily need to run it at server, however, I would like to use the ~/js/somefile.js syntax. Previously, I had just set everything with Absolute paths and set my project to be at the root level. SO, I'd just declare all my stylesheets,…
Armstrongest
  • 14,284
  • 13
  • 61
  • 102
13
votes
5 answers

Must be Placed Inside a Form Tag With runat=server

I have been attempting this all morning with no results. I can't seem to figure out what I'm doing wrong. I have checked out the two links (among many other unhelpful links) and have yet to solve my issue. This is a WebUserControl... Receiving the…
Volearix
  • 1,413
  • 3
  • 20
  • 46
11
votes
6 answers

asp.net: difference between runat="server" and server controls

What is the difference in functionality between and Does the input with runat="server" attribute…
Dasha Salo
  • 5,139
  • 5
  • 24
  • 28
11
votes
7 answers

Getting ID from asp.net runat server in jQuery

I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat="server" is not the same as the id used in HTML. I used to use this to get the ID from this situation: $("#<%=txtTest.ClientID%>").val(); But in this case, it does not work.…
Michel Ayres
  • 5,357
  • 8
  • 55
  • 92
10
votes
1 answer

document.getElementById('id').value failing in ASP.net javascript function

Hidden fields: javascript function: function doGetWave(obj) { //debugger var brk =…
todd.pund
  • 659
  • 2
  • 11
  • 34
10
votes
4 answers

LinkButton in ASP.NET MVC

I need to instantiate some ASP LinkButtons onto an ASP.NET MVC view page. I've tried a few things, and I cant get them to come out right. Heres my most recent incarnation of the code: the aspx file <% using (Html.BeginForm("TitleDetail",…
user90784
9
votes
4 answers

How can I access runat="server" ASP element using javascript?

It seems everyone is doing this (in code posts etc.)...but I don't know how. :( Whenever I try to manipulate an asp element using JavaScript I get an "element is null" or "document is undefined" etc. error..... JavaScript works fine usually,...but…
Andrew
  • 3,390
  • 8
  • 28
  • 32
8
votes
7 answers

Is it bad to use runat="server" on ?

I'm supporting an application that uses runat="server" all over the place to show/hide table rows. For example, in places where there are dependent DropDownLists, the row with the child ddl will be hidden until a value us chosen in the parent…
Homer
  • 7,084
  • 13
  • 66
  • 104
7
votes
3 answers

ASP.Net error - type is not compatible with the type of control

I have a web site i created using VS2012 web edition, Running a VB.net asp web site, In the VS2012 debug/release mode it compiles and everything works good, When i upload it to a server (Windows server 2008 R2) I get the following error: The base…
Matan L
  • 967
  • 3
  • 13
  • 34
7
votes
2 answers

what's the difference between <% %> and