473,769 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX UpdatePanel dynamic controls and RegisterStartUp Script click twice

149 New Member
Hi,

I have read hundreds of post regarding this issue, but none have an answer for my situation. So hopefully somebody here can help!

I have a gridview in an updatepanel (AJAX control toolkit) and because paging/sorting aren't supported I've added my own custom paging. I have dynamically loaded LinkButtons in the updatepanel to change the page but they only fire on the second click. I have also attached javascript to the rows so that they can be selected when you click. Again only the second click works.

I have DataBind in the event handlers and I only DataBind the first time when the page is loaded. When I debug the click events only fire the second time??

Any ideas?

Thanks in advance
Oct 31 '07
23 16213
Frinavale
9,735 Recognized Expert Moderator Expert
Hmm...let me think about this for a sec...

In the mean time... found this tadbit of information:


Doesn't help with your ID's being changed though.
Actually that might be the problem.
I remember that if you register a JavaScript for some control...that that JavaScript will not work for the control...and upon debugging the issue it was because the names of the controls get changed slightly...so the JavaScripts can't work properly.

You aren't actually supplying "_doPostBac k" JavaScript methods for these LinkButtons are you????
Nov 1 '07 #21
rsdev
149 New Member
No. I copied these values from the DOM they are created by .NET in the Page life-cycle, when I create the dynamic controls (OnLoad).

For some reason the first time they are created the ID is different to the second time. Then from the secodn time onwards they remain the same.

The 1 swaps with ct104 I think this is the Client ID for either the UpdatePanel or the placeholder inside it.

The only solution I can think of is to somehow fake a postback after the first load to enable the IDs to be updated. Seems like the wrong solution!
Nov 1 '07 #22
rsdev
149 New Member
Hmmm!

Just seen your post before the last one.

I am registering a ClientScript in the Page_Load method which resizes the and centers the DIV around the gridview. I'll try running without this script.

I'll have to post back tomorrow as it's getting late in the French Alps.

If you can think of any other helpful links I would be most grateful.

Thanks again.
Nov 1 '07 #23
rsdev
149 New Member
SOLVED!!

When dynamically adding the user control to the placeholder I was assinging an ID, in this case 1. But when I persisted the control on PostBack I wasn't assigning an ID. Doh!

I'm so used to assigning ID's to dynamic controls that I'd done the same thing with the user control. Which I suppose is fine, except if you don't assign the same ID on when the control persists.

Thanks for your help! The link to ASP.NET AJAX got me thinking and lead to the solution.

I also noticed it's possible to dynamically load a control directly to ContentTemplate Container and cut out the placeholder altogether.
Nov 2 '07 #24

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2814
by: brett | last post by:
I have an AJAX updatepanel in an aspx page. Inside the updatepanel is a placeholder control, which loads various ascx files. This all works fine. One of the ascx files also has an updatepanel in it. In the updatepanel is an ASP.NET image button that does a postback. So, it looks like this: aspx.updatepanel.Add(LoadControl(ascx control)) --ascx.updatepanel --imagebutton
4
2550
by: Rob Meade | last post by:
Hi all, I played with my first bit of AJAX the other week and was pleasantly surprised that I achieved my goal..now I'd like to try something else.. Question... If I have an updatePanel, and lets say I have a button as a trigger which runs a function in my code behind to add a textbox to the updatePanel, when the form is submitted does this control actually "exist" as such on the
8
2582
by: =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?= | last post by:
I am new to AJAX. I am applying AJAX to a current web solution to get the "instant behaviour". On my main page I have two sets of criteria: Specific and Wide. Each set is placed in a View container. I am not sure that I configured the Triggers correct, but the behaviour is OK. When I click the linkbuttons they switch between two sets of search controls. When I click the search buttons they reload the display panel. BUT .... if the...
2
2213
by: =?Utf-8?B?VG9u?= | last post by:
Hello, I want to understand teh benefits of ajax technology. Does anyone has a good website where AJAX EXTENSIONS is worked out so I really understand it. There a 2 main questions: 1) How about the form load event. Why should it fire when I put a button in a update panel? Is this necessary and is only the other controls related to the update panel send back? Or the whole page (If this is true I really do not get it). But please answer...
3
8210
by: JacekDr | last post by:
Hello, I've got the following problem: I want to add and remove dynamically controls to UpdatePanel. In my user control I have a button, but when I click it I get AsyncPostback and Event for ButtonClick in UserControl doesn't fire. <asp:ScriptManager ID="ScriptManager" EnableViewState="true" runat="server" EnablePageMethods="True" >
7
1730
by: MikeB | last post by:
Hello All, I am new to ajax and wanted to start by trying something simple. I have a web form with an updatepanel and then inside the update panel I have a listbox. Then outside of the updatepanel I have a button. In my buttons click event in the cs / code behind, I have a loop that just inserts items in the listbox. My question is, once I click the button and the loop begins, how do I get it to update the listbox? Does this make since?...
1
8203
by: abellix | last post by:
An updatepanel contains a datagrid, this datagrid has columns generated by code-behind: some columns should have async postback, others should have sync postback. Here a sample to reproduce the behaviour: it's a webform with some VB code-behind, you shoud create a new AJAX-enabled application and past the following code. (DEFAULT.ASPX) <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %> <html...
4
5359
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a text field which causes the Autocomplete extender to display 10 like items, after the users selects an item (which is a key in the database) I want the application to go to the database retrieve a record and populate the fields.
1
2064
by: raam | last post by:
Hi, I have ajax tab container with 6 tabs in it. I need to validate each tab contents separately and the validtaion summary must be separate for each tab. i cannot do that only one summary is being accesed. i also tried with validationgroup. Finlly i want each tab content to be validated and the content should accept the inputs.If any errors the message must display in summary separately. Here are 2 of my tabs.Dont feel bore pls let me...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.