Click here to Skip to main content
15,867,877 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
for example:
1.
linkBtnName.Attributes.Add("onmouseover","document.getElementById('someId').src='asdf.gif'"); 


2.
e.Row.Attributes.Add("OnDblClick", "__doPostBack('GridView1','Select$" + e.Row.RowIndex + "')");


It's a js expression,but I am so puzzled! So I want a introduction about this. See the 2 up there is a Select$, I don't know where its come. Because I never see one to use like that and I don't have an introduction about it. Please give information about this topic.

___________________________________________________________________
I mean I don't know how to use object's attributes.add() method.
for example:button.attributes.add()
textbox.attributes.add()
Posted
Updated 8-Nov-10 17:05pm
v5
Comments
shakil0304003 8-Nov-10 4:30am    
Not clear!!!
Baji Jabbar 8-Nov-10 5:06am    
Yes , its not clear. Some more detail will be helpful. What you actually want ? :)

Hi Angel,
Server controls like Button and label have properties (attributes) like runat, id, name, style.
Ex : <asp:label id="lbltest" runat="server" style="display:block" text="Test" xmlns:asp="#unknown">
here, id, runat, style and Text are the attribute, which means that attributes of the controls can be set at design time or runtime.

I hope this would help you.

Regards,
Jitendra Zaa
 
Share this answer
 
Comments
AngelLoose 9-Nov-10 20:16pm    
thanks
AngelLoose 9-Nov-10 20:16pm    
I see.But I want ask you how to use it in .cs document and how to write .Such as made a mouseover event.
You can use the attributes in several different ways:

1. When you assign an attribute to a "runat=server" control, it will render the attribute as an attribute of the underlying HTML tag, and, as you know, it will be a JavaScript expression description.

2. You can assign an attribute on the server side and later get this attribute on the server side inside a different procedure.
Say, you assign and attribute during the LayoutCreated event and get it back on ItemDataBound event. I found it very useful when working with databound controls
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900