473,513 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any way to set attributes for server controls by referencing properties/methods/variables?

Hi all,

I'm trying to find a declarative way to set server control attributes
using the attribute="<%= SomeValue %>" syntax.

This works fine for basic HTML controls, but server controls will
literally display the contained text, but won't execute the containing
code.

It works fine if I use the attribute="<%# SomeValue %>" syntax and
calling DataBind() in the code behind, but this feels really ugly.

Other than just setting the attribute in the code behind, is there a
better way to do this?

Any help would be appreciated.

Thanks,

Paul

Dec 6 '06 #1
1 1014
The databinding is how you do this. It isnt ugly, its just the way its done
<%= is shorthand for Response.Write which wont give server controls
information but is suposed to write things to the client on render.

--
Ciaran O''''Donnell
http://wannabedeveloper.spaces.live.com
"Paul" wrote:
Hi all,

I'm trying to find a declarative way to set server control attributes
using the attribute="<%= SomeValue %>" syntax.

This works fine for basic HTML controls, but server controls will
literally display the contained text, but won't execute the containing
code.

It works fine if I use the attribute="<%# SomeValue %>" syntax and
calling DataBind() in the code behind, but this feels really ugly.

Other than just setting the attribute in the code behind, is there a
better way to do this?

Any help would be appreciated.

Thanks,

Paul

Dec 6 '06 #2

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

Similar topics

1
6309
by: Will | last post by:
Hi all. I'm learning VB.Net and am developing a WinForms app. I'm trying to make an app that I will use to scan in one or more than on image. I want to use a tabbed interface to hold each image....
1
2504
by: Matthew Louden | last post by:
Personally, I am totally confused with the following control terms and usage and advantages of each one in ASP.NET web application. Here's what I know so far.. 1. HTML Client Control: understood...
3
1621
by: Janaka | last post by:
I've seen and used some samples where you can set the onclick attrubute to a Button control to get it to do some javascript a la : btnUse.Attributes = "DoSomeJS()"; However when i try and get...
4
1802
by: Mark | last post by:
I am setting up an asp.net site using the Ektron CMS. Every page in the site uses the same basic template, with the look of the page changing via CSS and an id on the body. The id is shared by all...
5
3568
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
8
1669
by: Thomas Girod | last post by:
Hi there. I'm trying to get a list of attributes from a class. The dir() function seems to be convenient, but unfortunately it lists to much - i don't need the methods, neither the built-in...
3
1775
by: vivekian | last post by:
Hi , I am moving on from C++ to C# . Though have understood how attributes work , still dont understand what need do the fullfil ? Where should they be used ? What are their advantages ? some...
2
13835
by: P4trykx | last post by:
Hello I'm want to add some custom attributes to WebControls using WebControl.Attributes.Add("abc","234"); So the html output will look like this, <input type="hidden" abc="123" /etc. I know...
26
1878
by: tjhnson | last post by:
Hi, With properties, attributes and methods seem very similar. I was wondering what techniques people use to give clues to end users as to which 'things' are methods and which are attributes. ...
0
7386
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
7543
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
7534
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...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.