Showing posts with label click. Show all posts
Showing posts with label click. Show all posts

Wednesday, March 28, 2012

HOW do I popup the model popup programmatically?

It's tried to a control click by default.
Does the model popup allow for programmatic viewing?

Thanks!

I really need this!

You can use a hidden button as the targetcontrolid of the modalpopup and have your button postback as normal. You can then call Show() from codebehind or show() from JS to show the modalpopup.


Someone posted this a while back. Another option would be to call the click method of the button you used for the targetcontrolid.

Show and Hide ModalPopupExtender from JavaScript

1) Assign a BehaviourID to the ModalPopupExtender using the BehaviourID attribute.

BehaviorID ="ModalBehaviour"
.ExternalClass .EC_csharpcode, .ExternalClass .EC_csharpcode pre{font-size:small;color:black;font-family:consolas, "Courier New", courier, monospace;background-color:#ffffff;}.ExternalClass .EC_csharpcode pre{;}.ExternalClass .EC_csharpcode .rem{color:#008000;}.ExternalClass .EC_csharpcode .kwrd{color:#0000ff;}.ExternalClass .EC_csharpcode .str{color:#006080;}.ExternalClass .EC_csharpcode .op{color:#0000c0;}.ExternalClass .EC_csharpcode .preproc{color:#cc6633;}.ExternalClass .EC_csharpcode .asp{background-color:#ffff00;}.ExternalClass .EC_csharpcode .html{color:#800000;}.ExternalClass .EC_csharpcode .attr{color:#ff0000;}.ExternalClass .EC_csharpcode .alt{background-color:#f4f4f4;width:100%;}.ExternalClass .EC_csharpcode .lnum{color:#606060;}.ExternalClass .EC_csharpcode, .ExternalClass .EC_csharpcode pre{font-size:small;color:black;font-family:consolas, "Courier New", courier, monospace;background-color:#ffffff;}.ExternalClass .EC_csharpcode pre{;}.ExternalClass .EC_csharpcode .rem{color:#008000;}.ExternalClass .EC_csharpcode .kwrd{color:#0000ff;}.ExternalClass .EC_csharpcode .str{color:#006080;}.ExternalClass .EC_csharpcode .op{color:#0000c0;}.ExternalClass .EC_csharpcode .preproc{color:#cc6633;}.ExternalClass .EC_csharpcode .asp{background-color:#ffff00;}.ExternalClass .EC_csharpcode .html{color:#800000;}.ExternalClass .EC_csharpcode .attr{color:#ff0000;}.ExternalClass .EC_csharpcode .alt{background-color:#f4f4f4;width:100%;}.ExternalClass .EC_csharpcode .lnum{color:#606060;}

2) Use the $find method to get a handle to the Modal Popup Behaviour .

$find ("ModalBehaviour").
.ExternalClass .EC_csharpcode, .ExternalClass .EC_csharpcode pre{font-size:small;color:black;font-family:consolas, "Courier New", courier, monospace;background-color:#ffffff;}.ExternalClass .EC_csharpcode pre{;}.ExternalClass .EC_csharpcode .rem{color:#008000;}.ExternalClass .EC_csharpcode .kwrd{color:#0000ff;}.ExternalClass .EC_csharpcode .str{color:#006080;}.ExternalClass .EC_csharpcode .op{color:#0000c0;}.ExternalClass .EC_csharpcode .preproc{color:#cc6633;}.ExternalClass .EC_csharpcode .asp{background-color:#ffff00;}.ExternalClass .EC_csharpcode .html{color:#800000;}.ExternalClass .EC_csharpcode .attr{color:#ff0000;}.ExternalClass .EC_csharpcode .alt{background-color:#f4f4f4;width:100%;}.ExternalClass .EC_csharpcode .lnum{color:#606060;}.ExternalClass .EC_csharpcode, .ExternalClass .EC_csharpcode pre{font-size:small;color:black;font-family:consolas, "Courier New", courier, monospace;background-color:#ffffff;}.ExternalClass .EC_csharpcode pre{;}.ExternalClass .EC_csharpcode .rem{color:#008000;}.ExternalClass .EC_csharpcode .kwrd{color:#0000ff;}.ExternalClass .EC_csharpcode .str{color:#006080;}.ExternalClass .EC_csharpcode .op{color:#0000c0;}.ExternalClass .EC_csharpcode .preproc{color:#cc6633;}.ExternalClass .EC_csharpcode .asp{background-color:#ffff00;}.ExternalClass .EC_csharpcode .html{color:#800000;}.ExternalClass .EC_csharpcode .attr{color:#ff0000;}.ExternalClass .EC_csharpcode .alt{background-color:#f4f4f4;width:100%;}.ExternalClass .EC_csharpcode .lnum{color:#606060;}

3) Call your hide and show methods on the acquired handle.

4) The Javascript would look like this.

<script language="javascript">function ShowModalPopup() { $find("ModalBehaviour").show(); }function HideModalPopup() { $find("ModalBehaviour").hide(); }</script>


Thanks.

I found what I needed:

ModalPopupExtender1.Show();


Hi ,

That would be meBig Smile.

Here is the link to the original Post.

http://blogs.msdn.com/phaniraj/archive/2007/02/20/show-and-hide-modalpopupextender-from-javascript.aspx

Hope this helps.


Hello,

I have a new problem.
How can I stop the modal popup from disappearing when a postback occurs.

For example, if I have a button on the modal "form", a click makes it dissappear.

Help!

Thanks!


The modal popup will disappear if the entire panel is wrapped in an updatepanel. You can move the update panel inside the panel tags or call Show() in server side code to keep it visible.

How do I know the load?

I have my web pages that are using web services via atlas technology. when page loads users can click on the links but get error because page has not been loaded yet. How do I know that page loaded on atlas? How do I know that procies are created? can someone provide me some working javascript or what ever is possible to detect it?

thanks and greately appreaciated

Hi,

just hook up the load event raised by the global Sys.Application instance. Here's the code to add to your page:

<script type="text/javascript">
<!--
function onLoad() {
// Put your Atlas stuff here.
}
//-->
</script>
<script type="text/xml-script">
<page>
<components>
<application load="onLoad" />
</components>
</page>
</script>

The above code will call the onLoad function (it's a javascript function that you have to define) when all the framework stuff is initialized.

Monday, March 26, 2012

How do I get the CalendarExtender to show over a dropdown?

I've read some of the posts that cover this topic and solve it with IFRAME but that involves mouseover or click events of a div. The CalendarExtender provides a convenient PopupButtonID attribute to display the calendar by clicking an image. How do I get the calendar to show over the dropdown below it when I click the calendar image next to textbox?

Below is the aspx markup followed by snippet of styles. Any help would be appreciated.

<divid="date">
<span>Date:</span>
<asp:TextBoxID="DateTextBox"runat="server"EnableViewState="False"></asp:TextBox>
<asp:ImageID="CalendarImage"ImageUrl="~/App_Themes/Default/Images/Calendar_scheduleHS.png"runat="server"/>
<AjaxControlToolkit:CalendarExtenderID="CalendarButtonExtender"TargetControlID="DateTextBox"PopupButtonID="CalendarImage"CssClass="MyCalendar"runat="server"/>
<asp:CompareValidatorID="CompareValidator5"runat="server"ErrorMessage="Must enter a valid date."Text="*"ControlToValidate="DateTextBox"Operator="DataTypeCheck"Type="Date"></asp:CompareValidator>
</div>

<divid="timeofday">
<span>Time of Day:</span>
<asp:DropDownListID="TimeOfDayDropDownList"runat="server"DataSourceID="TimeOfDayDataSource"DataTextField="Description"DataValueField="TimeOfDayID"EnableViewState="False"></asp:DropDownList>
<asp:ObjectDataSourceID="TimeOfDayDataSource"runat="server"SelectMethod="GetTimeOfDay"TypeName="FeederDataTableAdapters.TimeOfDayTableAdapter"></asp:ObjectDataSource>
</div>

/* CSS File */

#date{position:absolute;top:2em;left:1.4em; }
#dateinput{width:7em; }
#timeofday{position:absolute;top:4em;left:1.4em; }

The following page works fine for me in IE7 and IE6. What about you? If it breaks, what browser are you using?

<%@. Page Language="C#" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Sample Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:TextBox ID="TB" runat="server" /> <ajaxToolkit:CalendarExtender ID="C" runat="server" TargetControlID="TB" /> <br /> <asp:DropDownList runat="server"> <asp:ListItem Text="Item" /> </asp:DropDownList> </form></body></html>

The code you wrote works great except that I needed to register the System.Web.Extensions. When I wrapped the textbox and dropdown in divs the calendar appears behind the dropdown. Applying css and adjusting the z-index fixed the issue. I tried adjusting the z-index before posting but I must have had an old css file stuck in my browser cache. Below is the working code. Remove the z-index from both sytles to see the calendar go behind the dropdown.

Thanks.

 <%@. Page Language="C#" %><%@. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Sample Page</title> <style> #div1 { position: absolute; top: 6em; left: 3em; z-index: 101; } #div2 { position: absolute; top: 8em; left: 4em; z-index: 100; } </style></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div id="div1"> <asp:TextBox ID="TB" runat="server" /> <ajaxToolkit:CalendarExtender ID="C" runat="server" TargetControlID="TB" /> <br /> </div> <div id="div2"> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem Text="Item" /> </asp:DropDownList> </div> </form></body></html>

Thank you for the demonstration!

As it happens, once you start modifying the position style of things (done here with position:absolute), you take them out of the usual z-index process and bump them way up. So in this case, as soon as you absolutely position div2, you raise it above the Calendar and start hitting problems. Read more here if you're interested:http://www.w3.org/TR/CSS21/visuren.html#q29 andhttp://www.w3.org/TR/CSS21/zindex.html.

So because Calendar seems to work correctly under the normal HTML/CSS behavior as you confirmed above, I'm inclined to say that this is not a bug with Calendar, but rather a consequence of how CSS rules are applied.


Seeing as how this issue has come up for some other folks as well, I'm wondering if we should do something like add a ZIndex property to CalendarExtender so that people get better control of where their Calendar sits in the CSS z-index stack...

If it is merely a z-index issue you can try the following:

<style type="text/css">.ajax__calendar_container { z-index : 1000 ; }</style>

We are still working on the documentation for the CSS rules that can be used to redefine Calendar and Tabs. They use nested CSS class selectors to scope their layout. The calendar's "container" div tag is the highest styleable element, so you can update the default CSS class by adding a.ajax__calendar_container rule to either the head tag or to a linked stylesheet.

[ FYI: the CSS class name specifically is: ajax(underscore)(underscore)calendar(underscore)container ]

Ron


In my browser (version 6.0.2900.2180.xpsp_sp2_gdr.050301-1519) none of the examples work properly.

I thought there was a movement afoot to use an iframe or something.

Byron


rbuckton:

If it is merely a z-index issue you can try the following:

<style type="text/css">
.ajax__calendar_container { z-index : 1000 ; }
</style>

We are still working on the documentation for the CSS rules that can be used to redefine Calendar and Tabs. They use nested CSS class selectors to scope their layout. The calendar's "container" div tag is the highest styleable element, so you can update the default CSS class by adding a.ajax__calendar_container rule to either the head tag or to a linked stylesheet.

[ FYI: the CSS class name specifically is: ajax(underscore)(underscore)calendar(underscore)container ]

Ron

I am having a similar issue with the ValidatorCalloutExtender. I posted about it here:http://forums.asp.net/thread/1589043.aspx

If you can adjust the style of the calendar container as demonstrated above, can you do the same to the ValidatorCalloutExtender?


Funny - i tried putting that exact same page in my site and it doesn't display in IE6 properly...not sure why.

Byron

David Anson:

The following page works fine for me in IE7 and IE6. What about you? If it breaks, what browser are you using?

<%@. Page Language="C#" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Sample Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:TextBox ID="TB" runat="server" /> <ajaxToolkit:CalendarExtender ID="C" runat="server" TargetControlID="TB" /> <br /> <asp:DropDownList runat="server"> <asp:ListItem Text="Item" /> </asp:DropDownList> </form></body></html>

FYI from just-updatedwork item 7759:

A demonstration of the problem reported by this owrk item can be found in attached file Default7.aspx (courtesyhttp://forums.asp.net/thread/1550925.aspx).

My initial investigation led me to write:

"As it happens, once you start modifying the position style of things (done here with position:absolute), you take them out of the usual z-index process and bump them way up. So in this case, as soon as you absolutely position div2, you raise it above the Calendar and start hitting problems. Read more here if you're interested:http://www.w3.org/TR/CSS21/visuren.html#q29 andhttp://www.w3.org/TR/CSS21/zindex.html.

So because Calendar seems to work correctly under the normal HTML/CSS behavior as you confirmed above, I'm inclined to say that this is not a bug with Calendar, but rather a consequence of how CSS rules are applied."

The Calendar author's suggestion for how to work around this on affected sites (also fromhttp://forums.asp.net/thread/1550925.aspx) is to add the following to the page in order to give a z-index style to the Calendar and break out of the CSS situation I describe above:

<style type="text/css">
.ajax__calendar_container { z-index : 1000 ; }
</style>

This suggestion is valid CSS and works in most browsers. Unfortunately, it does not work in IE6/7 - an explanation of the reason why can be found athttp://www.aplus.co.yu/lab/z-pos/. Basically, IE6/7 get the CSS rules wrong here and so the only apparant workaround for IE6/7 seems to be to add a z-index style to the Calendar's parent element instead. This is not something Calendar can safely do in general, so it's left to the page author to do so as necessary. The attached file contains both workarounds (commented-out) for demonstration purposes. We will add a "known issue" to the sample page.


OK!!! This may have been corrected for comboboxes in the March '07 release, but is still occurring when the CalendarExtender is enclosed within another "bordered" control; ie: a grid whose size is delimited by a panel control. Maybe it's me, but it seems to me that a Calendar control such as this shouldALWAYS have the top most x-index. Btw, using IE7, applying the z-index within .ajax__calendar_container has no effect whatsoever!!! In order to make this control useful, MS really needs to think about adding some additional properties like being able to set the z order or visibility persistence, so at least user can scroll through the grid to make the calendar visible.


Last released didn't fix it for me. I still have the same problems displaying the calendar in a panel enclosed FormView. I don't get why the workitem is removed everytime stating it's fixed, cause it's not. There's a lot of documentation around about this problem: IE6 always renders select boxes on top of allmost all of the other components. The only way to fix this is rendering an iframe above the selectbox (one of the few controls which are rendered above a selectbox) and rendering the calendar above that (since it has no problem rendering above an iframe). This is done with the z-index property.

For more info: http://support.microsoft.com/kb/177378. Note that only the select box is listed as a windowed element. Thats exactly why this behaviour only occurs in IE6 and not in FF (not sure about IE7); FF's render engine doesn't render select elements above the rest of the page.


After installing the latest release I also noticed that I wasstill seeing calendars being displayed underneath select boxes. After looking into this issue I noticed that the iframe wasn't beingpositioned correctly when the calendar was inside a container thathad been positioned relative or absolute.

I added the following to my main stylesheet to position the iframecorrectly for the above situation.

.ajax__calendar { position: relative;}.ajax__calendar iframe { left:0px !important; top:0px !important;}

Note: I have not tested this under anyother conditions.

Hopefully this helps.


That didn't do it. For some reason the iframe is renderedafterthe select boxes and therefore doesn't work properly. I've been trying some css properties on the calendar and iframe class, but I can't get the iframe to display properly where I want it to.

Fixed it! The IFRAME is rendered as a new element in the parent node of the textbox; therefore it is placed after all the other elements, rendering in the wrong spot. This is easily fixed by surrounding the input and calendarextender with a DIV. Now the position is still wrong and the frame isn't begin displayed correctly. Adding the following code to your stylesheet should fix that:

.ajax__calendar {
position: relative;
left: 0px !important;
top: 0px !important;
visibility: visible; display: block;
}
.ajax__calendar iframe
{
left: 0px !important;
top: 0px !important;
}

For me this works fine in both IE and FF, but I can imagine it depends on the structure of your site. But with all the tips above I think the problem can be solved in 9/10 times.

How do I change a labels text (twice) in an UpdatePanel?

Hey,

I would like for a user to click an 'Add to Cart' Button, a message appears 'Adding Item to Cart ...', and then the message changes to 'Item added to Cart' when finished. I have under the AddToCart_Click event changing the label to 'Adding to Shopping Cart ...' then the code to actually add the item to the shopping cart and then changing the label to 'Item added to Cart.' However, only the last label is seen (Item added to Cart). Any suggestions on how to do this? Should I use 2 Update Panels? Or, how do I tell it to display both labels?

Thanks,
Beej

Hi

I am not sure about this, but please check Update progress or timer control from Ajax.Net. It may help you.

regards

Anuraj.P


I would suggest using the UpdateProgress component from the AjaxControlToolkit. What you specify in the ProgressTemplate tag of the UpdateProgress control will be visible during the callback, in your case the message 'Adding item to cart...'


SplashMan:

Hey,

I would like for a user to click an 'Add to Cart' Button, a message appears 'Adding Item to Cart ...', and then the message changes to 'Item added to Cart' when finished. I have under the AddToCart_Click event changing the label to 'Adding to Shopping Cart ...' then the code to actually add the item to the shopping cart and then changing the label to 'Item added to Cart.' However, only the last label is seen (Item added to Cart). Any suggestions on how to do this? Should I use 2 Update Panels? Or, how do I tell it to display both labels?

Thanks,
Beej

hi,

Subscribe to add_beginRequest and add_endRequest events of the Sys.WebForms.PageRequestManager like so:

<script type="text/javascript">
//<![CDATA[
var prm = Sys.WebForms.PageRequestManager.getInstance();
var displayLabel= $get("displayText");

prm.add_beginRequest(function(){
displayLabel.innerHTML = "Adding Item To Cart ...";
});

prm.add_endRequest(function(){
displayLabel.innerHTML = "Item added to Cart ...";
});
//]]>
</script>

hth

Saturday, March 24, 2012

How do execute a server-side click event for a ModalPopupExtender?

I have created a modal popup to show up during page load. It is my logon dialog box. Anyways, I have set the OkControl property to my logon button to execute some codes through the ModalPopupExtender control staticly and dynamically through Page_Load but both didn't work..

What is my problem?

Thanks!

Ok, I follow the flow from this person website.http://blogs.vertigosoftware.com/alanl/archive/2006/07/25/Creating_a_Confirmation_Using_the_ModalPopup_Extender.aspx It works with a button.

I want to use the SHOW event when the page load but it doesn't work. It seem like it is not rendering the javascript or couldn't find it.

What is my problem?


Hi,

Have you tried this link?

http://blogs.msdn.com/phaniraj/archive/2007/02/20/show-and-hide-modalpopupextender-from-javascript.aspx

How do add a click handler to a Button in Beta 1?

Hi All,

I must say I'm finding the move to Beta 1 frustrating.. Love to see documentation for something other than update panels :)

Can someone give me a hand with a simple UI event handler?

My Script Manager declaration looks like this:

<asp:ScriptManagerID="ScriptManager1"runat="server">

<Scripts>

<asp:ScriptReferenceAssembly="Microsoft.Web.Preview"Name="Microsoft.Web.Resources.ScriptLibrary.PreviewScript.js"/>

<asp:ScriptReferenceAssembly="Microsoft.Web.Preview"Name="Microsoft.Web.Resources.ScriptLibrary.PreviewGlitz.js"/>

<asp:ScriptReferenceAssembly="Microsoft.Web.Preview"Name="Microsoft.Web.Resources.ScriptLibrary.PreviewDragDrop.js"/>

</Scripts>

</asp:ScriptManager>

Problem code :

findButton =new Sys.Preview.UI.Button($get('FindButton'));

findButton.click.add(onFindLocation); // this line fails

Cheers!

Tim

Hi,

findButton.add_click(onFindLocation);

How can Rating Control triggers a event where i click the CurrentRating?

a Rating Control Question

when i clicked the star what was not CurrentRating, it triggered a Changed event,
but i clicked the CurrentRating star, nonthing happened.

now, i'm writting a project. it's needed to show a rating of a item, and allow users to rate it.
i encountered a trouble, user can't rate by the same rating

for example, the current rating is 3, a user wants to rate by 3, but no event been triggered, because Rating control only has Changed event.
if rating were not changed, no event occured.

how can i resolve the problem? write a new control class to extend Rating? or other easier methods?

hi, can someone help me ?

Wednesday, March 21, 2012

how can i know which updatepanel in multiple updatepanels at BeginRequest event

hello ,

I have two updatepanels . updatepanel1 and updatepanel2 . updatepanel1 trigger when button1 click . And then updatepanel2 trigger when button2 click . I add one client side event like this

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandler);

function beginRequestHandler(sender,args)

{

here . how can i know which updatepanel request ? because i want to do some when updatepanel2 request .

Please help me . show me with sample code .

Any post will be appreciated .

Thanks in advance.

kmhsad.

Why are you trying to track which updatepanel is updating when you can just handle the button that caused the update?


Hello ,

Thank you for your replied . i got idea . I am new for ASP.net . i didn't consider this idea before .

thank

How Can i Get the new Values from the PopupWindow in Atlas ModalPopupWindow with samples

if i change the textbox values in Popupwindow and if i click the ok button (ServerSide code) I cant get the new values from the popup window in modalpopupExtender.Anyone Please help me how can i get the new values from the popupwindow in atlas modalpopupExtender.Explain with simple example.

Thanks

Hi,

Try this:

<%@. Page Language="VB" %>

<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
TextBox1.Text = DateTime.Now.ToString()
End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="always">
<ContentTemplate>
<asp:Panel ID="Panel1" onscroll="javascript:saveScroll();" runat="server" Height="50px" Width="125px" Style="position: static;
overflow: scroll; height: 350px; border: solid 1px blue; background-color: White;
display: none;">
<table border="0" cellpadding="0" cellspacing="0" width="480px">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
<asp:Button ID="Button1" runat="server" Text="Update" OnClick="Button1_Click" />
<asp:Button ID="Button3" runat="server" Text="Close" />
<asp:Button ID="Button4" runat="server" Text="OK" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:Panel>
<asp:Button ID="Button2" runat="server" Text="Show" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" OkControlID="Button4"
CancelControlID="Button3" TargetControlID="Button2">
</cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>

<script type='text/javascript'>
var scrollLeft = 0;
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args) {
document.getElementById('Button2').click();
setScroll();
}

function setScroll()
{
document.getElementById('<%= Panel1.ClientID %>').scrollLeft = scrollLeft;
}

function saveScroll()
{
scrollLeft = document.getElementById('<%= Panel1.ClientID %>').scrollLeft;
}
</script>

</body>
</html>

Get the value in javascript via "document.getElementById('TextBox1').value".

Best Regards