Why is my ATLAS TEMPLATED USER CONTROL getting all instances of this controls methods called? I only want it called for the instance that I click the button from...

I have created a templated user control and it uses ATLAS. So...once the control loads, it then makes an ajax call to populate itself. 

"server" UpdateMode="Conditional" ID="UpdatePanel1" ChildrenAsTriggers="False" >
    


        "TNews1" runat="server">
            

BNNews(<%# Container.Row["TotalItems"].ToString()%>)

<%# Container.Row["NewsID"] %> - "BNP35.aspx?newsId=<%# Container.Row["NewsID"]%>&promoId=<%# TNews1.PromoIds %>"><%# Container.Row["HeadLine"] %>

            
            
        
        
The problem I am having is...if I put multiple controls on this page, and the method gets called in my controls codebehind...then I get called for every instance of the control that I have on my page. So if I have 5 instances of TNews on my page, then it will get called for each of them!
What am I doing wrong? Im using a hidden field to post back my data.
 I basically call this method to post back my data and update my panel:
 
function postBackHiddenField(hiddenFieldID, val) {
                var hiddenField = $get(hiddenFieldID);

                if (hiddenField) {
                    hiddenField.value = val;
                    __doPostBack(hiddenFieldID,'');
                    }
                }
  
 Basically my hidden fields are linked to a usercontrol. Each instance of update panel has its own:
 <input type="hidden" name="TNews1$hdnNewsTrigger" id="TNews1_hdnNewsTrigger" />
 
 
 
 
 
If this doesnt make any sense, please reply and I will explain better! 

"Only when we are no longer afraid do we begin to live" -D. Thompson // f bush.

-----------

"No man succeeds without a good woman behind him. Wife or mother, if it is both, he is twice blessed indeed." -Harold MacMillan

0
eron19
6/1/2007 6:08:17 PM
asp.net.ajax-discussion 13973 articles. 1 followers. Follow

2 Replies
1090 Views

Similar Articles

[PageSpeed] 27

What the hell happen to my code man!!!

 Argh!

 

Im using this method to update my controls, only I have my hidden triggers added dynamically by my usercontrols. 

http://weblogs.asp.net/rajbk/archive/2007/01/21/refresh-updatepanel-via-javascript.aspx

 

 MY CODE:

 

 <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdatePanel2" ChildrenAsTriggers="False" >
    <ContentTemplate>

 


    <emi:TNews ID="TNews2" runat="server">
        <HeaderTemplate>
            <h3>Editorials(<%# Container.Row["TotalItems"].ToString()%>)</h3>
        </HeaderTemplate>
        <ItemTemplate>
            <p>
           
            <%# Container.Row["NewsID"] %> - <a href="BNP27.aspx?newsId=<%# Container.Row["NewsID"]%>&promoId=<%# TNews2.PromoIds %>"><%# Container.Row["HeadLine"]%></a><br />

            </p>
        </ItemTemplate>
        <FooterTemplate>
        </FooterTemplate>
    </emi:TNews>

 


    </ContentTemplate>
    </asp:UpdatePanel>
 


"Only when we are no longer afraid do we begin to live" -D. Thompson // f bush.

-----------

"No man succeeds without a good woman behind him. Wife or mother, if it is both, he is twice blessed indeed." -Harold MacMillan

0
eron19
6/1/2007 6:42:06 PM

Hi. eron19

I am afraid I cannot find out the exact root cause without further information captured when the problem occurs.

 Maybe you can see this thread for answer:http://forums.asp.net/t/1117746.aspx        Trigger PostBack to an UpdatePanel from a separate UserControl

This will help you!

To troubleshoot this issue, we really need more source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

Thank you.


Sincerely,
Jin-Yu Yin
Microsoft Online Community Support
0
Jin
6/8/2007 9:04:34 AM
Reply:

Similar Artilces:

calling method in user control - keep getting error
Hello, If i dont call any methods of this user control The page runs fine and the user control displays correctly.But I need to pass some data to my user control but every time i try to call one of the user control methods I get the error -  Object reference not set to an instance of an object. I cant figure it out as I've used user controls before - but this user control has a datagrid - I think this might be why it is erroring?The html code look like -  <%@ Register TagPrefix="Check" TagName="CheckGrid" src="../includes/UserControls/Per...

want to call one c#.net function in one user control from another user control
hi i have two user controls info.ascx and personal.ascx i have a function like in info.ascx i have a function like showdetails() {   } now i want to access this function from personal.ascx can i do this ? thanks in advance. shwetaThanksshwetaIn a day when don't come across any problem -you can be sure that you are traveling in wrong path  you should better create a class where you will define the "functions" that you need in both files. declare "static" the function and call it like nameofclass.nameoffunction In a web project you can...

How to call user control procedure from button not in user control
Hi,I have a procedure in the code behind of my user control, e.g. PopulateGrid(). What I want to do is to call this procedure from a button that is not in the user control, but in the web form (.aspx). Clearly, if the button is included in the user control, then there's no problem because I can call the procedure by writing PopulateGrid().Any ideas on how to do this? Thanks,Xiangjiao I finally figured it out. I have solved my problem by creating an instance of my user control on the web form and then calling myUserControl.PopulateGrid(). ...

User control button click handler not getting called
I'm trying to build a user control for posting comments onto a blog post.  Yeah, I know I could re-use any number of blog engines out there, but it's more of a learning exercise than anything else for me. I have a "Submit" button on the control and neither the OnClick or OnCommand handlers are getting called.  The controls Page_Load method is called, but the click/command handlers are never called.  I've tried hosting this in both a MultiView and a LoginView and get the same behavior in either case.  I'm at a loss for how to ...

call method of parent user control on child user control
Hi, Does any1 let know , How to call method of parent user control on child user control actually my parent user control has a button .... and i wnt to call button click event of parent user control at child user control . Its Urgent plzz. Thanks, Mohit  In your parent UserControl, expose a public method.  Then in the child user control, cast Parent as the parent UserControl's type and call the method. (Parent as ParentUserControlType).MyPublicMethod();  "You shall love the LORD your God with all your heart and with all your soul and with all your mig...

Calling a user control method from another user control code behind
Hi there,In a webform I have a FormView. The ItemTemplate contains two users control, UC1 and UC2.  When certain event fires in UC1´s code behind, I need to call a public method in UC2. So I think from UC1´s event code I need to find the container FormView first, then find the ItemTemplate and finally find UC2 inside it, and then call UC2´s method.Is that the way to go? I would appreciate a lot some ideas/suggestions/C# examples on how to do this.Thanks in advance.    You can create a public method in a separate class so that you can call that method anywhere in your codes.....

Adding multiple instances of a user control to place holder and referencing controls within each instance
I need to code a web form where whenever the user clicks a button with a + on it an additional section is added to the form.  Each additional section will have a popup calendar control, 2 textboxes and 3 labels.  It seems to me that the best way to do this is to have a placeholder and add the new section to the placeholder as a user control.  I created a new .ASCX user control.  My project uses a master page so I created the master page and then a web content form.  I added a place holder to the web content form.  Then I wrote some code to add a n...

Dynamically loaded Web User Control .ascx button click event handler not called on second time click
I have an ascx control (that performs actions for an entity) being added dynamically to accordion panes, and then the panes are added to an ajax accordion control, so that the accordion can contain multiple panes with each pane containing one ascx control. The ascx control contains a delete button which removes the entity from the database. Once the entity is removed, I need to reflect this deletion in the parent page by removing the accordion pane from the accordion. To do this I created a delegate function and which is called from the parent page to rebind the accordion and hence not d...

how to create an instance of a user control from another user control
Hi,I have an aspx page that declaratively creates an instance of a user control. This user control programmatically creates an instance of another user control. The code is something like below.File 1 -- default.aspx <%@ Register TagPrefix="userControl" TagName="firstControl" Src="~/firstControl.ascx" %>..Same code here.. <userControl:firstControl runat="server" />..File 2 -- firstConrtol.ascx<%@ Reference Control="~/secondControl.ascx" %><script runat="server">   protected override void OnLoad(EventArgs e)   {   ...

User Control calling function in another user control?
Hey there folks, I have a user control (UCInside, e.g.) inside another user control (UCOutside). I want to call a function that's contained in UCInside from UCOutside. Since UCInside has an associated class (let's call it ClassInside), I figured I could call the function by a simple ClassInside.UCInside.MyFunction(params)This calls the function, but I then can't seem to access any of web controls in UCInside from that function. Specifically, I have a RadioButtonList defined in UCInside. I want to retrieve, and then use, the selectedValue in MyFunction. I get an 'object referenc...

Calling user control within another user control
I want to call one user control within another user control, but I get all sorts of errors when I try to do this. Is this possible ? if so how to go about it. {code} <%@ Control Language="C#" AutoEventWireup="true" CodeFile="i_top.ascx.cs" Inherits="i_top" %> <%@ Register TagPrefix="agg" TagName="siteowner" Src="~/templates/i_siteowner.ascx"%> <div id="navbar"> <h2 class="hide">Site wide navigation</h2> <ul> <li><a href='~/default.aspx' id...

Calling a User Control function from another User Control
I have several User Controls on my main page. They are basically DataLists that are filled contiginent on one another. How do I call a function in one User Control on the page from another one? I would not do that. I would more likely have the page control the interactions with both user controls, surface events on one or both of the controls and have the Page level code handle it. Generally, "Reaching Up" is not a great design. Linking the user controls in the way you are looking to will make them less generally usable, because they will depend upon each other. You could...

user control calling the function of another user control
I've created two user controls that are being placed on a aspx page: control1 and control2.  I would like to place a button on control1 and when the user clicks the button, I would like to call a function in control2.  How would I do this? TLAlway take some time for fun! Um, if this can be done then you would have to use the qualified name...   Control2.FunctionName(args) Otherwise, you can't do it this way, but you can do it by writing a Class in your App_Code folder and then have Control2 call said Function and then Control1 can as well. If this post hel...

Multiple instance of a user control (but dont know how to call the events)
Hi there ... I am creating a page which will request x number of uploads from a pc and store somewhere. e.g upload 10 photo's of yourself and store. Now the easy way is to paste the HTMLfileControl and a image view and cmd butoon 10 times and write events. I thought of a cool method ... why dont you create a repeater control and use a ItemTemplate and embed a usercontrol .. folow so far ??????.Have the repeater repeat 10 times the upload user control consist of a picture viewer,htminput file and a command button UPLOAD. The upload button has a click event which has logic i...

Web resources about - Why is my ATLAS TEMPLATED USER CONTROL getting all instances of this controls methods called? I only want it called for the instance that I click the button from... - asp.net.ajax-discussion

Facebook will soon start showing templated News Feeds to users without the app
Earlier this week, we wrote that our #1 request for improving News Feed functionality was the need to publish application stories to friends ...

François Beaufort - Google+ - Rich templated notifications are now available through the…
Rich templated notifications are now available through the new Notification Center in the last Windows chromium build available at…

“Scroll Kit” Tool For De-Templated Design Goes Live, Adds New Features
Synchronized perfectly with the start of the annual SXSW conference in Austin, Cody Bown and Kate Ray have announced improvements to their design ...

RNA-Catalyzed RNA Polymerization: Accurate and General RNA-Templated Primer Extension
The RNA world hypothesis regarding the early evolution of life relies on the premise that some RNA sequences can catalyze RNA replication. In ...

Wikipedia:Wikipedia Signpost/Newsroom/Suggestions - Wikipedia, the free encyclopedia
This page is for suggesting news to be covered in the next Signpost . For general discussion, comments or questions regarding The Signpost , ...

Wikipedia:Sockpuppet investigations - Wikipedia, the free encyclopedia
WP:RFCU redirects here. You may be looking for Wikipedia:Requests for comment/User conduct ( WP:RFC/U ), CheckUser policy ( Wikipedia:CheckUser ...

Recent changes - Wikitravel
Help Wikitravel grow by contributing to an article. Learn how . Recent changes From Wikitravel Jump to: navigation , search Track the most recent ...

Symbiosis Episode 46 – Blue Daisy
Blue Daisy exclusive mix & interview for Symbiosis. Blue Daisy aka Kwesi Darko hails from London and is signed to Black Acre. Not your typical ...

Government House NT - Patronages footer menu
The Office of the Administrator uses a selection of templated forms to assist organisations that are hosting the Administrator of the Northern ...

Why Zelda Still Rules the Action RPG
The Legend of Zelda games may not be perfect, but they still define the genre.

Resources last updated: 12/5/2015 1:35:36 AM