Take the 2-minute tour ×

We have a custom made server control which several properties defined in it.

<cc1:DropdownCheck ID="ddcStatus"  runat="server" CssClass="ddlchklst" JQueryURL="~/Scripts/jquery.js"
                    Title="Select Status(es)" OpenOnStart="false" divHeight="17px" 
                ImageURL="Images/DropDown.PNG" >

How can I set the value of the Title property on a click event of the server control. My current jquery fn looks like this...

$("#ddcStatus").click(function () {
            //$('#ddcStatus').attr("Title",'Items Selected');
            //document.getElementById("ddcStatus").Title = 'Items Selected';

Both statements didnt work. The getElementById statement gave a script error saying object null.

share|improve this question
What's the rendered html output of this custom control? This title property is a custom property displayed in a div or span? post the rendered html. –  Ritik Khatwani Sep 14 '12 at 4:55
Check how the element is rendered in the browser. Code has to be written based on it –  Sushanth -- Sep 14 '12 at 5:00
It worked after I re-wrote the query based on the rendered HTML. The title was shown as a div so i had to read the text property of the div! Thanks Ritik & Sushanth –  StewieHere Sep 14 '12 at 9:10
add comment

2 Answers

up vote 3 down vote accepted

Problem is in your selector "#ddcStatus" is use to select element with id ddcStatus but it is not same at clint side. You Wil see it something like "abc_xzy_ddcStatus"

ID get changed when page load at client side. so you have two option to solve it

  1. In browser go to source code by selecting view source or by inspect element and find new ID in source and use that ID in jQuery (I don't recommend this way)

  2. use something called dynamic selector which server ID and convert to Client ID by self


you can read this as "select in DropdownCheck whose id ends with ddStatus"

Your solution will not be same replace DropdownCheck with actual control used at client side some help for start with and end with style of jquery

http://api.jquery.com/attribute-ends-with-selector/ http://api.jquery.com/attribute-starts-with-selector/#attributevalue

share|improve this answer
add comment

Try doing something like that:

share|improve this answer
add comment

Your Answer


