Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search
  HOME    TRACKER    ASP.NET


Advertisements:










C# - UpdatePanel And Javascript?


I have inline script such as this, which toggles between an edit and a display divs. If it is inside the the UpdatePanel it requires two click before it works. If I remove the UpdatePanel it works fine with a single click.

<a href="#" onclick="edit(event,'ctl00_CPH1_ctl00_win1')">Edit</a>


EDIT:

Edit function:

function edit(e, id) {
var editdiv = $('#' + id).find('.edit');
var cntdiv = $('#' + id).find('.content');
if (editdiv.css('visibility') == 'hidden') {
editdiv.css('visibility') == 'visible'

[code]...


View 2 Replies (Posted: Jan 14 10 at 13:31)

Sponsored Links:

Related Forum Messages For ASP.NET category:
C# - Is It Possible To Re-execute Javascript In An UpdatePanel
I have the following:

<asp:UpdatePanel ID="upd" runat="server">
<ContentTemplate>
<script> alert("execute again"); </script>
<asp:LinkButton ID="go" runat="server" Text="Exec JS" />
</ContentTemplate>
</asp:UpdatePanel>

The first time the page renders the script is executed. If I click the button to cause a postback it doesn't execute again. Is there a way to make it execute the scripts again?

Posted: Dec 9 10 at 16:29

View 3 Replies!   View Related
How To Update Javascript In Updatepanel
lets say I've got a function that iterates over an array. The function is outside the updatepanel, the array is defined within the update panel. The items of the array are dynamically created. On the first try I've realized, that the values of the array do not update when the update panel loads again.

Posted: yesterday

View 1 Replies!   View Related
Execute JavaScript When UpdatePanel Finishes?
I have noticed that when i have JS inside of an update panel, and the panel update, it doesn't run the JS that it repopulates...is there a way on client side to capture the updatepanel's finish so i can call that JS manually OR is there a way to get that JS to run after the update happens

Posted: Dec 18th, 2009, 11:15 AM

View 5 Replies!   View Related
How To Run A Javascript Event After A Postback Within An Updatepanel
How do i run a javascript event after a postback within an updatepanel

Posted: Nov 19 10 at 9:53

View 3 Replies!   View Related
AJAX :: How To Enable Javascript In UpdatePanel
I have a updatepanel with a <div> that creates agoogle map. Thegoogle map is written in javascript and doesn't load when inserted into the updatepanel. I have done some research and Iread several things that lead me to believe I need to callaRegisterStartupScript somehow so that the updatepanel recognizes the javacript that creates the map

Posted: Dec 29, 2009 08:43 PM

View 13 Replies!   View Related
AJAX :: Bug In UpdatePanel Containing A Control That Has Javascript?
I cannot determine why this is happening, butI have narrowed it down to the javascript in one of the controls in an updatepanel.

ASP.NET 2.0aspx structure:

A formview contains a large updatepanel. The updatepanel contains all the controls on the page. Only three controls are autopostback=true: two dropdowns and a checkbox.

The last three controls in the updatepanel are textboxes. Their autopostback=false. Each textbox has ananchor whose javascript launches a pop-up calendar window. The pop-up calendar selection populates the corresponding textbox. No problems there.

The bughappens whenever I fill in all three dates at once (I launch the calendar three times and select a date each time), and then I click Save. The form's save action fails because the code can no longer get to the controls in the formview. The formview.controls.count is zero.

It works if I fill in any two of the three dates *or*I fill in all three dates by typing the values into the textboxes (bypassing the pop-up calendar). I can fill them in random order, and any one or two are fine, but all three at once triggers the error.

Posted: Apr 23, 2010 04:13 AM

View 9 Replies!   View Related
Call Javascript After Updatepanel Postback?
I put the following javascript code inline but it doesn't trigger after the updatepanel is done with its postback:

function EndRequestHandler(sender, args) { alert("this should work"); }
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

Posted: Feb 9 at 3:56

View 2 Replies!   View Related
Javascript - Set Always Focus On Textbox (Updatepanel)
Before I start to write my problem, I will excuse for my bad English and I hope you can understand me. I have in a ASP.NET Webapplication an AJAX Updatepanel. In this Updatepanel is a Textbox for dynamic search results. When I start to write in the Textbox, the results comes like Google suggest. Now, the focus must be always on the Textbox (inputn field), now metter whereto the User clicks. Currently the ASP.NET updatepanel refreshed after a few seconds when the User starts to type.

Posted: Oct 4 10 at 12:06

View 3 Replies!   View Related
Javascript - Open A Window In Updatepanel?
I have a pop-up CustomControl which I use in a large-scale web application. The pop-up works well everywhere other than when used inside an asp:UpdatePanel, the problem arises when controlling the visibility of the pop-up (the pop-up is nested in a table) with other controls:

When I click the button to open the window I get Error: Object expected and when I try to debug the error with IE 8 JSEditor I get ``Source Code is not available for this location.

I believe that the code of the pop-up is not being initialized completely, but it is just my guess and I don't know how to resolve this issue.

Posted: Nov 07, 2008 07:15 PM

View 1 Replies!   View Related
Javascript - Open A Window In Asp:updatepanel
I have a pop-up CustomControl which I use in a large-scale web application. The pop-up works well everywhere other than when used inside an asp:UpdatePanel, the problem arises when controlling the visibility of the pop-up (the pop-up is nested in a table) with other controls:

When I click the button to open the window I get Error: Object expected and when I try to debug the error with IE 8 JSEditor I get ``Source Code is not available for this location.

I believe that the code of the pop-up is not being initialized completely, but it is just my guess and I don't know how to resolve this issue.

Posted: Feb 13 at 10:28

View 2 Replies!   View Related
AJAX :: Updatepanel And Javascript File?
have found many solution for my issue but none doesn't work in my scenario. I have created a test project to demo my concept.Basically, there is a page that host a user control...

[Code]....

WebUserControl1 has a dropdownlist and two other webusercontrols (to be displayed based on the selection of dropdownlist element) inside updatepanel as below.

[Code]....

Code behind file for WebUserControl1 is .....

[Code]....

Now, the problem starts here...There is an external javascript file [JScript1.js] (embedded resource) which basically is used to display an alert box.

[Code]....

WebUserControl2.ascx.cs code behind is

[Code]....

Alert window doesn't get displayed when I change the dropdownlist value. Even the script is getting registered three times (look in the firebug) Need to use ScriptInclude instead of ScriptBlock as the original JS file is too big.

Posted: Mar 03, 2011 12:37 AM

View 2 Replies!   View Related
Update An UpdatePanel Manually Using JavaScript Or JQuery
Is it possible to update an UpdatePanel manually using JavaScript or jQuery?

What I have is a TextBox at the top of my page. When a user leaves that TextBox I want to run some server code (it will add a record to my database) then at the bottom of the page I have an UpdatePanel which will get refreshed. The UpdatePanel has a GridView which will have an entry for the record added)

Posted: Aug 16 10 at 3:46

View 2 Replies!   View Related
AJAX :: Run A JavaScript Function After UpdatePanel.Update()?
I thought that adding the javascript within the ContentTemplate would cause it to run every time the UpdatePanel was updated. For example, I would assume that for the following:

[Code]....

would cause the function alert() to run every time the UpdatePanel returns from the button click. This is not the case, however.

How do I do this? My update panel contains a scrolling Div and I want to scroll to a particular node after the UpdatePanel updates, and this is the only way I can think of to do it...

Posted: Feb 09, 2007 04:51 PM

View 18 Replies!   View Related
JavaScript - IE Slowing Down After Updatepanel Partial Update?
I'm trying to place a user control inside an UpdatePanel.

When the control is displayed, typing inside the TextBoxes has a large delay while in IE (6 & 8). FireFow has an excellent performance. Not only typing, but also scrolling etc experience a large delay up to a few secons.

The usercontrol(s) contain quite a lot of javascript functions that are re-registered using the ScriptManager.RegisterScriptBlock or RegisterStartupScript functions.

why typing becomes so very slow? I believe it has to do something with memory leaking due to the re-registering of the jQuery functions. But I'm unable to find the source of it.

Posted: Aug 3 10 at 9:19

View 1 Replies!   View Related
Javascript - AJAX Controls: UpdatePanel & UpdateProgress
It seems UpdateProgress will be displayed covering the entire area of the UpdatePanel. I want to replicate this behavior using plain javascript, as this behavior needs to be done for a windows client form. Are there any javascript libraries available? I am using a Browser control inside windows client form to get results and render them.

Posted: Aug 5 10 at 13:23

View 3 Replies!   View Related
How To Solve Javascript Error - Using ToolScriptManager For UpdatePanel
I am trying to register below mentioned javascript for using with GridView to add freeze functioality on GridView.
When compiling an error is thrown Microsoft JScript runtime error: 'Sys' is undefined

How it can be fixed.

<script language="javascript" type="text/javascript">
// This Script is used to maintain Grid Scroll on Partial Postback
var scrollTop;
//Register Begin Request and End Request
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
//Get The Div Scroll Position
function BeginRequestHandler(sender, args)
{
var m = document.getElementById('divGrid');
scrollTop=m.scrollTop;
}
//Set The Div Scroll Position
function EndRequestHandler(sender, args)
{
var m = document.getElementById('divGrid');
m.scrollTop = scrollTop;
}
</script>

Posted: Sep 15 10 at 9:02

View 1 Replies!   View Related
Javascript - Updatepanel Inside Hidden Panel Possible Bug
The javascript generated by the asp.net SciptManager control seems to have a bug and cant handle hidden UpdatePanels. A javascript error is thrown when a control within one updated panel tries to make another update panel visible. Is this a bug with ASP.Net ajax? And does anyone have any ideas how to get around this? heres is an example of what im trying to do

<script type="text/C#" runat="server">
protected void LinkButton1_Click(object sender, EventArgs e)
{
Panel1.Visible = true;
}
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" Text="Show Panel"></asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Panel ID="Panel1" runat="server" Visible="false">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>

this is the javascript error that gets thrown when clicking on the "LinkButton1" link. This error comes from the javascript that is generated by the asp.net ScriptManager control

Error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_ContentPlaceHolder1_UpdatePanel2'

Posted: May 27 10 at 2:41

View 2 Replies!   View Related
AJAX :: Cancel Updatepanel Callback With Javascript Or In Any Other Way?
I have a updatepanel which contains of a few dynamically created ImageButtons (the ImageButtons are placed in a panel inside the updatepanel) Since the imagebuttons are children of the updatepanel they automatically triggers a callback to server, fine. But I want the user to be able to cancel the callback after clicking on the imgbutton, preferably through a javascript window.confirm.

I have managed to make it work with a jquery function returning false (i dont know why it works, dont really understand asp.net ajax functionality) but it only works until a callback is done, then I guess I have to rebind the jquery to the controls in the updatepanel or?this turned out to be a jquery question. How do I rebind the recently loaded controls in my updatepanel to my jqyery function? the controls all have the same class and I use that to trigger the jquery function.

aspx file
..
..
$('.myImgButtons').click(function(){
if(window.confirm('Cancel callback?') )
return false;
});
..
..
<asp:UpdatePanel ..... >
<ContentTemplate>
<asp:panel id="myPanel" ........ ></asp:Panel>
</ContentTemplate>
<Triggers>
..whatever..
</Triggers>
</asp:UpdatePanel>
aspx.cs file
..
..
ImageButton dyn_ImgButton = new ImageButton();
dyn_ImgButton.Attributes.Add("class", "myImgButtons");
add dyn_ImgButton to myPanel
..
..

Posted: Apr 22, 2010 10:07 AM

View 9 Replies!   View Related
AJAX :: Call Javascript Inside Updatepanel?
I have a rquirement thay in grdivew need to show the 2 custom ads and 3 google ads, so i have written an user control and inside that using the adsense script, and binding the gridview manually with 2 custom ads and then calling the user control with few functionality. But i have used ajax to ignore the post back So while clikging on paging the google ads are not loading as they are loading from javascript.I came to know that we cannot call javascript inside updaetpanel means Ajax, this is an urgent requirement for me,

Posted: May 26, 2010 04:24 AM

View 2 Replies!   View Related
AJAX :: Call A Javascript Function With UpdatePanel?
I use from updatepanel in my page,me want to call a javascript function after updatepanel refreshed.How can me do it?

Posted: Nov 09, 2009 10:06 AM

View 1 Replies!   View Related
Javascript - Retrieve If An Updatepanel Has Made A Postback?
I can retrieve with JavaScript above the ASP.NET Updatepanel had made a asynchronous postback ?

Posted: Oct 8 10 at 11:21

View 1 Replies!   View Related
Make Javascript Work Along With Ajax UpdatePanel?
I am trying to add validation on my form. I am using AJAX controls in my form fields.
When I remove the Update panel and AJAX control, my validation starts working, but when keeping both the things together, my validation is not working. How could I make them work together?

<script type="text/javascript">
function Validate() {
var QuestionTextArea = document.getElementById("ctl00_ctl00_cphBody_midbox_fvInsert_txtQuestion");
varError = "";
if (!IsTextBoxEmpty(QuestionTextArea, "
Question Text Area not be Empty.")) {
alert(varError);
document.getElementById("ctl00_ctl00_cphBody_midbox_fvInsert_txtQuestion").focus();
return false;
} return true;
}
</script>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtQuestion" runat="server" MaxLength="1000" Columns="50" Rows="5" Style="width: 380px;
float: none" Text='<%# Bind("Description") %>' TextMode="MultiLine" />
<AjaxControl:TextBoxWatermarkExtender runat="server" TargetControlID="txtQuestion"
WatermarkCssClass="water" WatermarkText="Type your Question Here.">
</AjaxControl:TextBoxWatermarkExtender>
</ContentTemplate>
</asp:UpdatePanel>

When I removes ajax extender and Update Panel. My textbox gets validated and when using UpdatePanel. No javascript function created by me is called.

Posted: Aug 27 10 at 17:32

View 1 Replies!   View Related
AJAX :: UpdatePanel Preventing JavaScript From Running?
on my page I have a GridView that displays a bunch of people from different parts of the world. I display their names, email addresses, etc. I also wanted to display the local time of their location but I didn't want this to be a snap shot of the time when the page gets rendered so I decided to use JavaScript to display the time and have the clock keep ticking.

I found a nice jQuery plug-in called jClock which is very simple to use and implement. I simply place a <span class="timeZoneID"></span> and it works like a clock -- except if I place my GridView in an UpdatePanel.

It wasn't working and I kept troubleshooting to no avail. I thought it was the GridView's TemplateField somehow throwing some junk in there. Then I tried removing UpdatePanel and everything started working fine.

Why is UpdatePanel preventing this JavaScript from functioning?

Posted: Feb 16, 2010 08:39 PM

View 8 Replies!   View Related
AJAX :: JavaScript Alert In Code Behind Within Updatepanel
I am using the javascript alert in code behind but after click the Button i trigers the javascript,it's working fine with the update panel but if i using update panel now action work on my program

Posted: Jan 05, 2010 08:37 AM

View 1 Replies!   View Related
Assign Javascript CallBack Function To UpdatePanel?
I wanna assign a JavaScript CallBack function to an UpdatePanel which will be gets called when the UpdatePanel finishes its tasks. After, the UpdatePanel will be sending a string as a result. This JavaScript CallBack function will have to process this resulting string.

Posted: Jul 10 10 at 13:48

View 1 Replies!   View Related
AJAX :: UpdatePanel And Onload=JavaScript Function
I am trying to work through a program but getting really stuck.I have a asp.net (aspx) page which shows a table of data from a SQL query to the DB. This all works fine. I have a <body onload='resizediv()';> which calls a JavaScript code that resizes the DIV that the table data is displayed in - just so it adds a scrolling area if the table data is >400px deep.This all works just fine and as it should.

So I thought I would Ajax enable it with a panelupdate control which I wrapped around the Table and DIC that displays the data from the DB. Again this all works as it should - clicking on my "refresh" control button the ajax re-loads the table data without the nasty page flicker.

BUT - my onload='resizediv();' JS function is not called when the updatepanel is refreshed ... it is called the first time the page loads but not when I click on the button control that does the refresh of the panel. Is there anyway to make this JS function fire each time the Ajax panel is updated ?

Posted: Feb 28, 2007 11:30 AM

View 17 Replies!   View Related
AJAX :: Javascript In Updatepanel Only Running Once On Load?
I have a piece of inline java script which is within an AJAX updatepanel. The code works perfectly on1st load but not when the updatepanel is updated.

My script is as follows:

<script type="text/javascript">
var flashvars = {};
flashvars.galleryURL = "Photo_gallary/personal.xml";
var params = {};
params.bgcolor = "000000";
params.allowfullscreen = true;
params.allowscriptaccess = "always";
swfobject.embedSWF("Photo_gallary/simpleviewer.swf", "flashContent", "100%", "250", "9.0.124", false, flashvars, params);
</script>

As this is not a function how do I put it in the ScriptManager.RegisterStartupScript - which is I think what i have missing.

Posted: Jul 27, 2010 03:54 PM

View 5 Replies!   View Related
JavaScript - Jquery Change HTML Inside UpdatePanel?
I've got UpdatePanel with Div

<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
<div class="pnlFind" style="display:none;">
</div>
</telerik:RadAjaxPanel>

wanna use js for showing this div

[code]....

but after partial postback, I got div invisible again(right! restore DOM) How can I remember that div should be always visible after button click.

Posted: Aug 17 10 at 3:20

View 1 Replies!   View Related
AJAX :: Call A JavaScript After An Updatepanel Has Finished Update?
I want a Javascript function to be called automatically after the UpdatePanel has finished updating its contents. I don't want to use:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest

and then call a JS function. This is because I have more than one update panels and I'll have to write all the condions to check which UpdatePanel was actually called and then do something. Can something be done using Triggers in UpdatePanel. Kindly let me know how this can be done.

It would be great of you could post a sample code too.

Posted: Dec 03, 2010 05:58 AM

View 4 Replies!   View Related
Web Forms :: How To Activate Javascript Function From Page_Load And Updatepanel
In the first Page_Load, I am activating a javascript function to make an ImageButton change between 2 images with an interval.

This works fine.

Now when pressing this imagebutton, the Page_Load event will fire the second time and all this is happening in an updatepanel which means a partial postback.

The question is how to execute the javascript function stopbk() in the Page_Load event in this scenario as I cant just put itin the "Onload". How can I make that work?

Code is below:

[Code]....

Posted: Feb 13, 2011 08:54 PM

View 3 Replies!   View Related
AJAX :: Javascript Allert Inside UpdatePanel Not Working
I am having problems with alert box not popup when I'm using AJAX UpdatePanel. The following is what I have and it's not working.

[Code]....

I have to stress that the reason why it does not work is because I'm using AJAX UpdatePanel. If I turned off the AJAX UpdatePanel then it works perfectly. So does anyone have solution to go around this AJAX UpdatePanel issue?

Posted: Jun 21, 2007 01:46 PM

View 18 Replies!   View Related
AJAX :: Javascript Doesn't Work Inside Updatepanel
I hade a user controlin my web application that I hadinserted into an update panel.. after doing that the javascript of that control stoped working!

Posted: Feb 01, 2010 08:21 AM

View 4 Replies!   View Related
AJAX :: How To Close Calendarextender Updatepanel While Javascript Popup
in my aspx page,

1. am using calendarextender bind with text box

2.button click event call th SQL stored procedure to save the form values

3. after save and get the output value from the SQL SP ( its boolean value)

4. if true i have to show the javascript alert or else nothing have to alert, so this is the code

if (CheckandBooked())
{
ScriptManager.RegisterClientScriptBlock(btnBook, typeof(string), "alertscript", "alert('Selected time period clashes with existing booking');", true);
}
bug:this is working good but while showing the alert time i can see the calender( it look like design view) the design is adjusted how to avoid this

Posted: Nov 12, 2010 12:44 AM

View 13 Replies!   View Related
Javascript - Auto Partial Page Refresh Without UpdatePanel?
I want to make auto partial page refresh in asp.net. There is UpdatePanel but it sends too much data. So I've found that I can make a webservice and call it by the JavaScript code. But I don't know how to call webservice automatic. There are many examples showing how to call webservice by the button click event:

[URL]

How to do this by the interval? Am I going in good direction?

Posted: Oct 24 10 at 9:40

View 1 Replies!   View Related
AJAX :: Alternative To Response.write And Javascript In An Updatepanel?
i have a page in an iframe.when i want to redirect the top page i used to use the fn RedirectTopFrame below.I have now switched to ajax updatepanels and have stoped all postbacks on the page.The probelm is i can no longer use response.write to redirect the top frame.I have tried to use a literal control and pass the javascript block in RedirectTopFrame into the literal control when it is time to redirect but this is not being fired. i guess because the page only runs through the javascript on a pageload/postback.so how can i redirect the top frame ? (response.redirect only redirects the inner page NOT the top frame)the only way i can think of doing it is to set a function on an interval to check for a url in a hidden field and then redirect if it is not empty ,but this is messy as i want a solution that i can reuse on nearly every page (i have 20+pages all in iframes that need to be able to redirect the top frame)

public
void RedirectTopFrame(HttpResponse response,
string url)

[code]...

Posted: May 20, 2008 04:20 PM

View 7 Replies!   View Related
AJAX :: Not Running Javascript Inside Updatepanel When Marquee Is Active?
I am having trouble with getting the Jscroller2 too work inside an updatepanel after I have added a marquee as a newsbanner. - (The marquee is running outside the updatepanel)Beforer the marquee was present I could trigger the JavaScript with:

[Code]....

Now the Jscroller2 only works when the page is loading the first time and notafter the updatepanel has updated.So my question is how do I get the Javascript to fire after the updatepanel have updated when a marquee is present?

Posted: Mar 12, 2010 07:53 PM

View 7 Replies!   View Related
AJAX :: Trigger UpdatePanel Via Javascript Doesn't Work When Using A MasterPage?
I have an UpdatePanel on the page which I'd like to trigger using javascript.First of all my code perfectly works if it's in a website not being inheriting from a masterpage. Now when you put exactly the same code into a website which inherits from a masterpage, the UpdatePanel wouldn't get fired anymore.

Here's the code (.aspx) [Code]....

Here's the code (.cs) [Code]....

Posted: Apr 22, 2010 07:56 AM

View 2 Replies!   View Related
Javascript - Register Script After Partial Page Postback (UpdatePanel)
I have a simple form (textbox, submit button) which is wrapped in an update panel.

[Code]....

I type some text in the textbox, click submit, then the server creates a database record and returns an object, which has properties like ID, Name, URL, Blah, etc. These are the values that the script requires.

So if i were to call a web service from the client-code, in order to get the values that were just created, i would need to do some hacks (get last record modified that has the value of the textbox). Not ideal, and neither is two AJAX calls for one form post. (update panel postback, then web service call).

Posted: Aug 26 10 at 0:06

View 1 Replies!   View Related
Execute JavaScript From Code - Behind After UpdatePanel Has Finished Loading Its DOM Elements?
I have an UpdatePanel with a repeater in it that is re-bound after a user adds an item to it via a modal popup. When they click the button to add a new row to the repeater the code-behind looks something like this:

protected void lbtnAddOption_Click(object sender, EventArgs e)
{
SelectedOption = new Option()
{
Account = txtAddOptionAccountNumber.Text,
Margin = chkAddOptionMargin.Checked,
Symbol = txtAddOptionSymbol.Text,
Usymbol = txtAddOptionUsymbol.Text,
};
Presenter.OnAddOption(); // Insert the new item
RefreshOptions(); // Pull down and re-bind all the items
mpeAddOptionDialog.Hide(); // Hide the modal
// ... Make call to jQuery scrollTo() method here?
}

This works fine and the new row will show up quickly via the UpdatePanel. However, there are often hundreds of rows and where the new one is added is based on the current sorting column used. So, I wanted to take this as a chance to use the sweet jQuery ScrollTo plugin. I know that if I give it the ID of my overflowed container div and the ID of an element within it, it will smoothly scroll straight to the users newly added row. However, there are two problems:

I need to find the appropriate row so I can snag the ClientID for it. I need to execute the jQuery snippet from my code-behind that will cause my newly updated repeater to scroll to the right row. I've solved #1. I have a reliable method that will produce the newly added row's ClientID. However, problem #2 is proving to be tricky. I know I can just call ScriptManager.RegisterStartupScript() form my code-behind and it will execute the JavaScript on my page.

The problem I'm having is that it seems that it is executing that piece of JavaScript before (I'm guessing) the newly refreshed DOM elements have fully loaded. So, even though I am passing in the appropriate jQuery line to scroll to the element I want, it is erroring out for me because it can't find that element yet. Here is the line I'm using at the end of the method I posted above:

string clientID = getClientIdOfNewRow();
ScriptManager.RegisterStartupScript(this, typeof(Page), "ScrollScript", String.Format("$("#optionContainer").scrollTo("{0}", 800);", clientID), true);

What do I need to do so I can ensure that this line of JavaScript isn't called until the page with the UpdatePanel is truly ready?

Posted: Jul 7 10 at 3:43

View 2 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved