473,394 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

What is 'Runat" and what does it do?

I wrote an ASP Web App in Visual Studio and I want the user entered
data to go to a specific server. This runat looks like it is trying to
post to the asp page.

If I remove all instances of it, it looks like it works but it screws
up my page.

What does this command do and can I work around this?

May 10 '06 #1
5 2199
Runat sets where the code is to be processed for the item. The only
available option is server. This allows you to process code in the
code-behind for that item.

for instance, <table id="myTable" runat="server">... Will allow you to
access the table named myTable from your code behind. Note: for this to
work properly you may need to manually add the member to your code
behind as well..

protected System.Web.UI.HtmlControls.HtmlTable myTable;

now you'll have access to all the members of the HtmlTable myTable.

it's the same for all the drag and drop server controls as well.

-Rick

May 10 '06 #2
PS. To send the data to a specific server (database server) that is set
up by the data access logic components and the connection string
(SqlDataAdapter, SqlCommand, etc).

-Rick

May 10 '06 #3
More technically, runat="server" is something that ASP.NET compiler parses
for in order to turn an html tag into a server side control.

Karl

--
http://www.openmymind.net/

<ms*****@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
I wrote an ASP Web App in Visual Studio and I want the user entered
data to go to a specific server. This runat looks like it is trying to
post to the asp page.

If I remove all instances of it, it looks like it works but it screws
up my page.

What does this command do and can I work around this?

May 10 '06 #4
I wonder why this isn't simply the default action for asp.net controls.

Karl Seguin [MVP] wrote:
More technically, runat="server" is something that ASP.NET compiler parses
for in order to turn an html tag into a server side control.

Karl

--
http://www.openmymind.net/

<ms*****@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
I wrote an ASP Web App in Visual Studio and I want the user entered
data to go to a specific server. This runat looks like it is trying to
post to the asp page.

If I remove all instances of it, it looks like it works but it screws
up my page.

What does this command do and can I work around this?


May 10 '06 #5
Using the runat and id attributes of a control you can access them
programmatically via code-behind. You can take a native HTML element
such as a table add unique id's to the table rows <TR> with the
runat="server" attribute and show/hide certain rows based on user input.

May 10 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
7
by: Brad | last post by:
I'm placing a runat=server attribute on the <title> tag in my pages, so I can read/set the title text in code. The problem is that when I subsequently change the page in design view VS is...
2
by: Lubomir | last post by:
Hi, I have a BoundColumn in a DataGrid: <asp:BoundColumn DataField="lastname" SortExpression="lastname" ReadOnly="True" HeaderText="Last Name"></asp:BoundColumn> Column is sorted. I am...
3
by: Jeff | last post by:
hey asp.net 2.0 If I have a plain html table in my asp.net 2.0 webpage, and later decide to add this property: runat="server" to the table. Does this turn the table into a asp.net table...
4
by: Chris | last post by:
Hi, i 'm experimenting with postback and i tried that with a button server control and an Html input button but with runat="server". The button server control causes a postback, but not the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.