84529

Make element id smaller in ASP.NET Winforms?

Question:

I have a ASP.NET Winform website. Id´s of the elements are often long, like this :

ctl00_ContentPlaceHolder1_ShowThreads1_repThreads_ctl03_divThreadTitle

Most of the id´s is only used at server side so there is really no point in sending id to the client.

Is there anyway to handle this or will I have to manually change my names to somthing like this :

ctl00_CPH_ST1_rT_ctl03_dTT

This will of couse dont say much about the element but the total amount of data sent to client would be reduced a lot.

Answer1:

Use the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode(v=vs.110).aspx" rel="nofollow">ClientIDMode</a> property introduced in .NET 4.0. You might want Static since that will make it just divThreadTitle.

Recommend

  • Activator.CreateInstance MissingMethodException
  • How to Cache Images Dynamically-Generated with PHP?
  • passing parameter to server in ExtJs
  • Why does NotifyIcon not set SynchronizationContext?
  • Programatically open file in visual studio
  • retrieving data from url in iphone
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • 550 Access denied - Invalid HELO name
  • how does System.Web.HttpRequest::PathInfo work?
  • Ember.js model to be organised as a tree structure
  • Spring Cloud Microservice Architecture Confusion
  • Transactional Create with Validation in ServiceStack Redis Client
  • Jackson Parser: ignore deserializing for type mismatch
  • Test if a set exists before trying to drop it
  • Chrome doesn't support silverlight anymore? How to solve this?
  • Django rest serializer Breaks when data exists
  • OpenGL ES texture problem, 4 duplicate columns and horizontal lines (Android)
  • Handling un-mapped Rest path
  • How to rebase a series of branches?
  • Android screen density dpi vs ppi
  • PHP - How to update data to MySQL when click a radio button
  • Azure Cloud Service Web Role web pages do not load
  • Resize panoramic image to fixed size
  • How would I use PHP exceptions to define a redirect?
  • Volusion's generic SQL folder, functionality
  • Controls, properties, events and timers running in design time
  • How to extract text from Word files using C#?
  • what is the difference between the asp.net mvc application and asp.net web application
  • How can I estimate amount of memory left with calling System.gc()?
  • Calling of Constructors in a Java
  • Traverse Array and Display in markup
  • Transpose CSV data with awk (pivot transformation)
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j
  • How to stop GridView from loading again when I press back button?
  • need help with bizarre java.net.HttpURLConnection behavior