Home > C# > Some Asp.net Tips with javascript, masterpage , AJAX and jQuery

Some Asp.net Tips with javascript, masterpage , AJAX and jQuery


1- What is the difference between ID and ClientID For any server control ?
both of them is the same in page that don’t bind with master page
the difference will be in the ClientID will be changed and this one is used to deal with java script .
Ex:

drag and drop one textbox control in default aspx page without master page

and at load event write :

textbox1.text=”Some Text Here”;

textbox1.Attributes["onfocus"] = “alert(textbox1.value)”;

and run the page and set focus on the control , you will find the alert message is shown with Some Text Here as a text

it’s works !!

now take the same code to page binded with masterpage and run the page

you will find the code not work

and the cause is :

textbox1.value is changed

to

ctl00_ContentPlaceHolder1_Text1.value

now change it to the new value and run the code

it’s works

Mail Me @ bagalaty@hotmail.com

with Subject : Some Asp.net Tips with javascript, masterpage , AJAX and jQuery

to give you sample example, cause i can’t attach file from here !!

Categories: C# Tags: , , , , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.