ID problem in usercontrol's sub control


I have created a user control in which I have one html table with marked runat as server.

now I have used this user control twice on a web page.

now the problem is whenever I click on the first usercontrol on the webpage it assume the second user control as the event originator. 

please help. 


4/29/2009 4:55:54 AM 3498 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 47


you can fire events by delegate for this purpose......User control communication working via delegetes and events...

you need more clarifications??



Please, Mark as Answer if this reply helped you

4/29/2009 5:17:22 AM

Give different id to html table to differentiate.

Please mark it as answer if it resolves the issue.

4/29/2009 5:52:42 AM

Similar Artilces:

Usercontrol vs Custom Server Controls, Any need for Custom Server Controls
Hello I'm new to ASP.Net so this is probably a stupid question but, is there any need to create customer server controls now that you can pre-compile usercontrols into a dll and thus easily share between applications? This blog post from David Ebb describes how to do it and the restrictions he note don't seem that bad (other than being able to embed resources such as images in the dll). His article desribes the techniques for ASP.Net 2.0 and he suggests that there will be further improvements in .Net 3.5 in this ar...

problems listenening to events on a custom server control from another custom server control
 Hi all,I am having problems listening to events on one of custom server controls(AddBookmark) from another custom server control(BookmarkList). The listener or the BookmarkList control has a property that can be set to the AddBookmark control (string at design but the reference is obtained at run-time). I am able to get a reference to the AddBookmark control and add a listener to it on the BookmarkList control on the OnPrender of BookmarkList. But the problem is that when the events on AddBookmark gets fired, the listener added from the BookmarkList is no longer present and the listene...

Problems with Control ID's assigned by the Repeater control
Hi all,I have a Repeater Control on a page that gets populated via a method in the code-behind page that gets data from the database. For each <ItemTemplate> I have a Panel control and a Linkbutton where the Linkbutton makes the Panel visible or not-visible. But, I am unable to do this because the ID of the Panel is being randomly generated by ASP.NET because it is in a Repeater contol (for example, the ID being out for the Panel is, 'RprContacts__ctl0_Panel5'. Is there a way I can override this ID assigned to each Panel that is output by the Repeater control? Or even to use an Increme...

Problem finding Server control's child controls by Page.FindControl
Hello all, I am unable to find my Web Custom Control's child controls by using Page.FindControl on my WebForm. I have a web custom control which has a label and a text as its child controls Now On my WebForm the code is - SampleControl.SimpleControl SC = (SampleControl.SimpleControl) Page.FindControl(SimpleControl1.ID) TextBox tb = (TextBox) SC.FindControl(SimpleControl1.ID + "_myTb");   where, SimpleControl1 is an object of type my custom control SimpleControl i get an error, 'tb' shows as undefined_value Do help me if u can. Regards, Sanchita...

Read in ID's of all instances of a custom control within cached user control
Could you suggest any possibility to obtain a list of ID's of custom controls (class "Region") contained within a particular user control. My main content page contains one or more "regions" i.e. instances of a user control, that is, by the way, cached using the PartialCaching attribute. On my admin page, i need to list the different regions contained in my main content page, in order to associate certain data items with these regions. I'm desperate. Any ideas? Thanks a lot.###################### Raphaël Michel :: TNM :: Yeah, sure, no pro...

Naming a document element problems (trying to getElementByID() but the id's of the control are staring with _'s, which are not valid)
This page is an almost working implementation of viewing the HTML source, you'll see the two files are very close, with the difference being that the spans in the working on faulty version are named "_ctl0_Strategy0" instead of "Strategy0". That causes the getElementByID() javascript function to fail because id's staring with _'s are not valid). Since as far as I know, I can't control the control's naming prefix (via a C# command), how do I get around this?Mark You could just append the _ctl0_ in your JavaScript.Are you making this ...

User Control Within UserControl
If I have a user control A and then inside it a user control B embedded/referenced within it.  User Control A has a panel defined (cpeNewUser) that I want to manipulate from the code behind of User Control B based on some event that happens.So putting this in my code behind of User Control B won't work as it has no idea of cpeNewUser:cpeNewUser.Collapsed = true;So is it because only at runtime they are married up and because of this you cannot access each other's objects at compile time?  How would I get this to work becuase I'm using all user controls inside a AJAX Too...

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

ISSUE WITH Control's behaviour inisde UPDATE PANEL
 hii evry1..,             i have an strange chk it out..                      aspx page:            < asp:UpdatePanel ID="OUpdatePanel" runat="server" >                <ContentTemplate>             &nbs...

The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource' could not be found.
what i'm missing that i get the error: The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'AccessDataSource' could not be found.      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="NewsId"                  EmptyDataText="There are no data records to display.">          &nb...

The DataSourceID of 'gv2' must be the ID of a control of type IDataSource. A control with ID 'objDs1' could not be found.
i have a radiobutton list and gridview and a object data source at runtime i'm changing the object data source by clicking on the radiobutton list selected index changed and here is my source code....          <asp:RadioButtonList runat="server" ID="rblView" RepeatDirection="Horizontal" RepeatLayout="Flow" AutoPostBack="True" OnSelectedIndexChanged="rblView_SelectedIndexChanged">                &nb...

The DataSourceID of 'DetailsView1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource1' could not be found.
 Anyone help with this? i have tried lots of ways to query this database and create the insert command, including making my own data sets and setting it up that way with my own custom SQL statement.....this did not work, so i though i would use VWD 2008's own tools to create the insert, i have been left with the following error: The DataSourceID of 'DetailsView1' must be the ID of a control of type IDataSource.  A control with ID 'AccessDataSource1' could not be found.   Everything looks ok to me. Code below:   <%@ Page Title="" Lan...

How do fix the error The DataSourceID of 'DataGrid1' must be the ID of a control of type IDataSource. A control with ID 'SqlMedTable' could not be found.
How do you fix the error: The DataSourceID of 'DataGrid1' must be the ID of a control of type IDataSource.  A control with ID 'SqlMedTable' could not be found.Here is the code.protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) {MedicalClassLibrary.Connection c = new MedicalClassLibrary.Connection(); c.GetMedicalTable();DataGrid1.AutoGenerateColumns = true; DataGrid1.DataSource = c.DS;InputDiv.Visible = false;Label1.Visible = false; txtRx.Focus(); } } Here is the class medhod:public void GetMedicalTable() {string medTable = "SELECT ...

how to have both server controls and html controls rendered in a custom control?
I have a custom control in which there is an html text box.when you click on it , a div containing a table is appeared and according to what you select in that table a text is set to the text box. It works fine but the problem is: as the text box is an html element it doesn't have viewstate and when a post back occures in the page its value disappeares.I tried a hidden field to keep its value.again there is another problem : I put this custom control in a usercontrol and put the usercontrol in a multiview and by clicking on a button this view is selected and by clicking another bu...

Web resources about - ID problem in usercontrol's sub control -

Resources last updated: 12/16/2015 3:03:36 PM