User Control and Controls IDs problem

G

Guest

I have a user control with name FoldersManager in the user control i have a
datagrid to view items retrieved from XML file

in ItemDataBound i did

if(e.Item.ItemType == ListItemType.Header)
{
e.Item.Cells[0].Text = "<input onclick='refresh(this);' type=checkbox
id=allmsg>";
}

when I run the page containing the user control i view HTML source in found
the
control like this:

<input id="oFoldersManager_dgFoldersInfo__ctl9_delmsg" type="checkbox"
name="oFoldersManager:dgFoldersInfo:_ctl9:delmsg" />

oFoldersManager : my user control object
dgFoldersInfo : DataGrid In the user control.

why the ID has this form though i provided the ID of control in ItemDataBoud.
 
G

Guest

very good article , but if i need to get the ID from client side what should
i do?

Scott Allen said:
It's been changed by the parent container (DataGridItem) to prevent
the ID from conflicting with other control ID's on the page. My
article here touches on this a bit:
http://odetocode.com/Articles/116.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

I have a user control with name FoldersManager in the user control i have a
datagrid to view items retrieved from XML file

in ItemDataBound i did

if(e.Item.ItemType == ListItemType.Header)
{
e.Item.Cells[0].Text = "<input onclick='refresh(this);' type=checkbox
id=allmsg>";
}

when I run the page containing the user control i view HTML source in found
the
control like this:

<input id="oFoldersManager_dgFoldersInfo__ctl9_delmsg" type="checkbox"
name="oFoldersManager:dgFoldersInfo:_ctl9:delmsg" />

oFoldersManager : my user control object
dgFoldersInfo : DataGrid In the user control.

why the ID has this form though i provided the ID of control in ItemDataBoud.
 
J

Juan T. Llibre

re:
if i need to get the ID from client side what should i do?

Why would you want/need to do that ?

Provide some inkling of a good reason to do that,
and I'll consider researching your need.






Raed Sawalha said:
very good article , but if i need to get the ID from client side what
should
i do?

Scott Allen said:
It's been changed by the parent container (DataGridItem) to prevent
the ID from conflicting with other control ID's on the page. My
article here touches on this a bit:
http://odetocode.com/Articles/116.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

I have a user control with name FoldersManager in the user control i
have a
datagrid to view items retrieved from XML file

in ItemDataBound i did

if(e.Item.ItemType == ListItemType.Header)
{
e.Item.Cells[0].Text = "<input onclick='refresh(this);' type=checkbox
id=allmsg>";
}

when I run the page containing the user control i view HTML source in
found
the
control like this:

<input id="oFoldersManager_dgFoldersInfo__ctl9_delmsg" type="checkbox"
name="oFoldersManager:dgFoldersInfo:_ctl9:delmsg" />

oFoldersManager : my user control object
dgFoldersInfo : DataGrid In the user control.

why the ID has this form though i provided the ID of control in
ItemDataBoud.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top