What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 59397 |  Welcome, Guest!   Register  Login
 Home > Forums > JavaScript > what is this how to avoid "ctl00" ...
Gow.Net

what is this how to avoid "ctl00"

Replies: 4 | Posted by: Gow.Net on 7/28/2012 | Category: JavaScript Forums | Views: 679 | Status: [Member] | Points: 10  


following scrip i am using in asp.ne web application
this code will be write in my master page

 <script type="text/javascript">


function IAmSelected(source, eventArgs) {

$find('"AutoCompleteExtender3 ').set_contextKey(eventArgs.get_value());
$find('"AutoCompleteExtender2 ').set_contextKey(eventArgs.get_value());


}

</script>


<table>

<tr>

<td>

<asp:TextBox ID="txt_city" runat="server"></asp:TextBox>

<asp:TextBoxWatermarkExtender ID="watermark1" runat="server" TargetControlID="txt_city" WatermarkText="Coimbatore"></asp:TextBoxWatermarkExtender>

<asp:AutoCompleteExtender ID="cityautocomplete"

TargetControlID="txt_city"

runat="server"

MinimumPrefixLength="1"

CompletionInterval="10"

EnableCaching="true"

ServiceMethod="GetCompletionList"

OnClientItemSelected="Selectarea"

ServicePath="~/AutoComplete.asmx"></asp:AutoCompleteExtender>

</td>

<td>

<asp:TextBox ID="txt_Search" runat="server" Height="21px" Width="281px"></asp:TextBox>

<asp:AutoCompleteExtender ID="Searchautocomplete"

TargetControlID="txt_Search"

runat="server"

MinimumPrefixLength="1"

CompletionInterval="10"

EnableCaching="true"

ServiceMethod="GetSearchList"

ServicePath="~/AutoComplete.asmx"></asp:AutoCompleteExtender>

<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txt_Search" WatermarkText="Search Example - ICICI Bank"></asp:TextBoxWatermarkExtender>

</td>

<td>

<asp:TextBox ID="txt_Place" runat="server"> </asp:TextBox>

<asp:AutoCompleteExtender ID="AutoCompleteExtender1"

TargetControlID="txt_Place"

runat="server"

MinimumPrefixLength="1"

CompletionInterval="10"

EnableCaching="true"

ServiceMethod="GetAreaList"

ServicePath="~/AutoComplete.asmx"></asp:AutoCompleteExtender>

<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" runat="server" TargetControlID="txt_Place" WatermarkText="Rspuram"></asp:TextBoxWatermarkExtender>
</td>

<td>

<asp:Button ID="btn_Search" runat="server" Text="Go" onclick="btn_Search_Click" />

</td>

</tr>
</table>



when i run my application in IE and view page source means following changes will be occurred

 <script type="text/javascript">


function IAmSelected(source, eventArgs) {

$find('"ctl00_AutoCompleteExtender3 ').set_contextKey(eventArgs.get_value());
$find('"ctl00_AutoCompleteExtender2 ').set_contextKey(eventArgs.get_value());

}

</script>


i am using .net frame work 3.5 anyone please tell me how to solve his auto generation ID

gowthaman8870226416


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Maneel
Maneel  
Posted on: 7/30/2012 1:08:41 AM
Level: Starter | Status: [Member] | Points: 25

Hi,
"ct100" means it is clientID generated in HTML which is unique. The unique clientid generated for every control in html which will be series like "ct100_" whatever the control you have in your application will have its own unique clientid. This id will be same in all the browsers we dont have any browser related issues for this. one more advantage by this clientid if you dont get control in javascript we can use this clientId manually to get the control. For example
you are writing like this.....
$find('"AutoCompleteExtender2 ').set_contextKey(eventArgs.get_value());
if you are not getting control by this means you can give manually like this to get the control.....
$find('"ctl00_AutoCompleteExtender2 ').set_contextKey(eventArgs.get_value());

Gow.Net, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Rajkatie
Rajkatie  
Posted on: 8/2/2012 4:00:42 PM
Level: Silver | Status: [Member] | Points: 25

Hi,

you can avoid this problem if your are using .net framework 4.0 because it has introduce new property called ClientIDMode which have four properties like AutoID,Static,Predictable and Inherit.

For more details each of these, visit http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode.aspx

Rajesh Patel
MCPD,MS
Brainbench (Asp.Net 4.0 and CSS 3.0)

Gow.Net, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Bhupentiwari
Bhupentiwari  
Posted on: 8/3/2012 12:35:29 AM
Level: Starter | Status: [Member] | Points: 25

Hi,
Set CleinIDmode property to static it will not come.

use framework 4.0

Thanks n Regards
Bhupendra Tiwari

Gow.Net, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Gow.Net
Gow.Net  
Posted on: 9/11/2012 11:47:15 AM
Level: Starter | Status: [Member] | Points: 25

how to set Set CleinIDmode property to static .

gowthaman8870226416

Gow.Net, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 7:22:46 AM