Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can we increament the id of button in asp.net in code behind???
Posted
Comments
Sergey Alexandrovich Kryukov 14-Apr-12 22:13pm    
Why? why?!
--SA

1 solution

ASP.NET can generate any HTML code, even invalid, and generate any id, but doing it normally makes no sense. Id is just the id; normally it is not the integer number to be incremented. Usually this is some arbitrary string used to uniquely identify any HTML DOM element by the JavaScript on the client side. For this purpose, id is usually kept the same at all times.

When asking such questions, you should always explain the purpose of the question and your ultimate goals. If you did that, I'm pretty much sure you would get an advice on practical technique not based on such weird operation.

—SA
 
Share this answer
 
Comments
Jignesh J patel 15-Apr-12 5:55am    
i have developed timetable for class in that i have used no. of button. on click i have inserted values in table. but when i want to update type of the lecture to lab at that time i want to disable the below button also. so i asked this question for that purpose..
Sergey Alexandrovich Kryukov 20-Apr-12 17:27pm    
I see, thanks for the explanation. You don't need to increment anything. You can generate id depending on the row number (such as id="button034", for a row #34), or you can use jQuery to calculate position of a child HTML element in the children of the parents, using
http://api.jquery.com/category/traversing/
--SA

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