DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 21 Jun 2007 16:01:16 -0400,    posted on: microsoft.public.dotnet.framework.aspnet.buildingcontrols        back       

Thread Index
  1    Monty am
          2    (Walter Wang [MSFT])


UserControl... where is the clientID on the client side?   
[ASP.Net 2.0, WAP, Atlas]

I have a custom usercontrol that looks something like this:

<%@ Control Language="vb" AutoEventWireup="false" 
Codebehind="ItemPicker.ascx.vb" Inherits="myNS.ItemPicker" %>
<div runat=server id=divMain style="text-align:justify; overflow-x:hidden;">
<div id="divItemList" class="ItemPickerList" runat="server">
 <asp:Repeater ID="rprItems" runat="server">
 <ItemTemplate>
  <div class=ItemPickerItem id='<%#me.uniqueID 
%>_<%#Container.DataItem("ItemID")%>'><%#Container.DataItem("Description")%></div>
 </ItemTemplate>
 </asp:Repeater>
</div>
</div>

In the Page_Load of this control, Me.ClientID = 
"ctl00_ContentPlaceHolder1_ItemPicker1". However, when I look at the page 
that is rendered, there is no element that has 
"ctl00_ContentPlaceHolder1_ItemPicker1" as an ID. There is, of course, 
"ctl00_ContentPlaceHolder1_ItemPicker1_divMain". I kinda thought if a 
control had a client ID it would, uhhh, have that ID on the client. I tried 
wrapping it all in a DIV and setting the DIV ID like so: <div 
id='<%=me.clientID%>', but that was a no-go of course. The only reason I 
care is because in the page that hosts this control I am registering the 
control for AsyncPostBack  (like 
ScriptManager.RegisterAsyncPostBackControl(ItemPicker1)). In the 
__doPostBack event, it is looking for a control with the ID of 
"ctl00_ContentPlaceHolder1_ItemPicker1", but of course can't find it. Any 
suggestions? TIA!

(Bonus question: is there a MS newsgroup for Atlas?)
Date:Thu, 21 Jun 2007 16:01:16 -0400   Author:  

RE: UserControl... where is the clientID on the client side?   
Hi Monty,

I don't think you can use RegisterAsyncPostBackControl on a UserControl 
instance. A control has ClientID property, doesn't necessary mean the id 
will always be used on the rendered page. For a UserControl, by default it 
only acts as a naming container (implements INamingContainer interface). 
Child controls inside a naming container will use parent's ClientID as 
prefix.

When a control is registered via RegisterAsyncPostBackControl, it must 
occur in the posted form data. Usually a control that will post the form 
can be used with it.

I also noticed you're using me.UniqueID to generate the client id of the 
div; I think you should use ClientID (the difference between UniqueID and 
ClientID is the separator used to compose the result from ID property).


There's no dedicated newsgroup for ASP.NET AJAX now, you can just post in 
asp.net related newsgroups. 


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Date:Fri, 22 Jun 2007 09:40:48 GMT   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us