Showing posts with label method. Show all posts
Showing posts with label method. Show all posts

Wednesday, March 28, 2012

Calling Custom Client Method with xml-script

Here is the situation, I have created a custom class that inherits from the ATLAS foundation client classes, I can initialize it with no problems with-in the xml-script, but what I want to do next is have a button call a method that of my custom client class, I know to add the button and click behavior but after that I am not sure what to declare as all the examples that I find are for web services and global javascript functions. Here is a tiny excerpt of the code I am working with to help:

I want to call MyContainer.AdjustThumbnailDimensions method and pass in the attributes from the two text form fields. Any help would be greatly apprieciated.

1<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>23<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">4<html xmlns="http://www.w3.org/1999/xhtml">5<head runat="server">6 <link href="CSS/Thumbnail.css" rel="stylesheet" type="text/css" />7 <title>Untitled Page</title>8</head>9<body>10 <form id="form1" runat="server">11 <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />1213 <div id="ThumbnailContainer" thumbnailHeight="150" thumbnailWidth="100">14 <div class="Thumbnail" img="Images/Space.gif" label="Test Thumbnail"></div>15 <div class="Thumbnail" img="Images/Joker.jpg" label="Joker"></div>16 <div class="Thumbnail" img="Images/Space.gif" label="Another Test"></div>17 </div>1819 height <input type="text" name="tHeight" value="150" size="4" /> width <input type="text" name="tWidth" value="100" size="4" /> <input id="adjustDimensions" type="button" value="Adjust Thumbnails" onclick="AdjustThumbnailDimensions( document.forms[0].tWidth.value, document.forms[0].tHeight.value );" />20 </form>21 <script>22My.Client.UI.MyContainer = function( associatedElement ) {23 My.Client.UI.MyContainer.initializeBase(this, [associatedElement]);2425 var m_Thumbnails = new Array();26 var m_ThumbnailHeight;27 var m_ThumbnailWidth;2829 this.initialize = function() {3031 for( var index = 0; index < associatedElement.childNodes.length; index++ ) {32 thumbnail = associatedElement.childNodes[index];33 m_Thumbnails[index] = new SGP.SPI2.Client.UI.Thumbnail( thumbnail );34 m_Thumbnails[index].initialize();3536 m_Thumbnails[index].set_ThumbnailHeight( m_ThumbnailHeight );37 m_Thumbnails[index].set_ThumbnailWidth( m_ThumbnailWidth );38 }39 }4041 this.AdjustThumbnailDimensions = function( width, height ) {4243 for( var index = 0; index < thumbnails.length; index++ ) {44 m_Thumbnails[index].set_ThumbnailHeight( height );45 m_Thumbnails[index].set_ThumbnailWidth( width );46 }4748 }4950}51My.Client.UI.MyContainer.registerClass( "My.Client.UI.MyContainer", Sys.UI.Control);52Sys.TypeDescriptor.addType("script", "MyContainer", My.Client.UI.MyContainer);53</script>54 <script type="text/xml-script">55 <page xmlns:script="http://schemas.microsoft.com/xml-script/2005">56 <references>57 <add src="Thumbnail.js" />58 </references>59 <components>60 <ThumbnailContainer id="ThumbnailContainer" />61 <button id="adjustDimensions">62<!-- What to do here ?? -->63<click>64 <invokeMethod />65 </click>66 </button>67 </components>68 </page>69 </script>70</body>71</html>
Thank youOk, I have figured out what I was missing from more disection of the ATLAS runtime and hunting around for more examples of invokeMethod. I had to add the method getDescriptor and then I was able to reference my method. Now the next phase to bind the parameters to the form fields.

Calling An UpdatePanel Update from Javascript

From client side javascript I want to invoke an UpdatePanel's Update event. I do not see any documentation on a method to do this. I found triggers but those are based upon controls, I want to do this purely via javascript.

I wonder if
the internal method Sys.WebForms.PageRequestManager _updatePanel Method does the job.

Calling a Web service method that returns an XmlDocument object

I'm calling a webservice method that returns an XmlDocument object. I'm getting the result back object back, but in my SuccededCallback function I'm having trouble navigating through the object with JavaScript. I'm trying to use methods on the object like .selectsinglenode and .selectnodes etc, but I keep getting a script error; "Object doesn't support this property or method. Any ideas? I'll post some of the code i'm trying to work with below.

Here is how i call the method from the client ...

Navegate.Services.GeneralTasks.GetSelectedPartyNumber(guid, id, SucceededCallback, FailedCallback);

Here is the web method ...

<WebMethod()> _

<ScriptMethod(ResponseFormat:=ResponseFormat.Xml)> _

PublicFunction GetSelectedPartyNumber(ByVal sessionguidAsString,ByVal idAsInteger)As XmlDocumentDim oXmlDocumentAs XmlDocument

oXmlDocument =

New XmlDocumentWith oXmlDocument

.LoadXml(

"<DocumentPacket><Company><Number>12345</Number></Company></DocumentPacket>")EndWithReturn oXmlDocument

EndFunction

And here is how i handle the response from the webservice method but get an error on .selectsinglenode ...

function

SucceededCallback(result)

{

alert(result.selectsinglenode(

"DocumentPacket/Company/Number").text);

}

Umm... Since it took five hours for this to post i was able to find the solution elsewhere.

I worked after I user .selectSingleNode instead of .selectsinglenode.

Calling a static page method using Asp.net AJAX and then clicking elsewhere on the page

Hi All! I seem to have reached a snag and hoping someone out there can help me...Basically, I am letting the user click a button on my site which uses AJAX to call a static page method on my page which runs a complicated query in my database. The query can take up to 5 minutes to complete so I wanted to use AJAX to let the user still surf my site while the query was running in the background. However, once the user clicks on a button and tries to navigate anywhere else on the site the browser gets "stuck". It won't let you surf anywhere else...it sort of just hangs there until the browser receives a message back form the server saying the query succeeded or failed. I thought you can make more than one web service call at once? If you can't, is there a way to make a call to the server, but not necessarily wait back for a response?

Any help would be appreciated. Thanks!

The Ajax webservice/pagemethod call is always async, you should be able to do the other operations in the page. Can you pls post your code, so that we can verify it.


Below is my aspx code:

<scriptlanguage="javascript"type="text/javascript">

// <!CDATA[

function Button1_onclick() {

PageMethods.WriteReport(OnSucceeded);

}

function OnSucceeded(result)

{

$get('GenerateLabel').innerHTML = result;

}

// ]]>

</script>

</head>

<bodystyle="text-align: center">

<formid="form1"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"EnablePageMethods="True"/>

<inputid="Button1"style="position: relative"type="button"value="Run Report"onclick="Button1_onclick()"/>

This is my code behind page:

[WebMethod]publicstaticString WriteReport()

{

String UserName =HttpContext.Current.User.Identity.Name;

int reportsID = (int)HttpContext.Current.Session["reportsID"];

Reports rep = (Reports)HttpContext.Current.Session["Report"];

try

{

Sharing.WriteActualReport(reportsID, rep, UserName); //This is the method that takes a few minutes to complete and where it get stuck.

}

catch (Exception)

{

return"An error occurred."

}

return"Success!";

}


There is nothing wrong in your code. You should be able to do any thing when the method is in progress. but what other operations you are trying to do?


KaziManzurRashidsuggested the following solution which worked on my computer. I'm still not sure why calling a static page method still stalls my site (on my computer), but the below code seemed to work well:

KaziManzurRashid:

No i did not encounter that, I was able to click different parts of the page. [Edited] It is not a good practise to run such a long process in the server. However, you can utilize the ThreadPool to generate this report in the server. in that case the the message will be returnded instantly to the user. May be the following will code will help you:

[WebMethod()]public string GenerateReport(string param1,string param2){ System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(GenerateReportInternal),new object[] { param1, param2 });return"Report generation started";}private void GenerateReportInternal(object state){object[] pair = (object[])state;string param1 = (string)pair[0];string param2 = (string)pair[1];//Generate your Report over here. //Fake delay for your test. System.Threading.Thread.Sleep(1000 * 60 * 5);}

Thanks again!

Calling a server side method.

My experience lies with Ajax.net. I need to call a method passing parameters back on the server. What ATLAS methodology should I do?

Imagine the scenario where I have a ordered list and I have the option client side to change the order. After each order change (the client UI is modified), I need to just touch a method on the server. I don't need any response or updates back.

I would like to do something like this

function OnItemMoved( first, second )
{
AltasCall.MovingObject.MoveItems( first.ID, second.ID );
}

Hi,

a PageMethod seems appropriate for your scenario. Basically you have to add the [WebMethod] attribute on your server method (you have to declare this method in your Page class), make it public and then you will be able to call it on client side through the PageMethods namespace:

function OnItemMoved( first, second )
{
PageMethods.MyMethod(first, second);
}

I appreciate it greatly, works like a charm.

Do you know if it is possible to call another method outside the Page class's scope? This is library code, and I don't want to force the end user to declare this method on all their pages.


billrob458:


Do you know if it is possible to call another method outside the Page class's scope?


At the moment the methods must be put in the Page class. One solution to your problem would be to wrap the library method with a WebMethod and put it in a base class that inherits from Page. The other pages will then be derived from the base class.
Another solution would be to expose the reusable method as a web service - which can act as a wrapper for your library code. Then you can make the calls to the webservice from anywhere.

calling a server side method to rebind and refresh a datalist in updatepanel without a ful

I have 2 datalists:

datalist1 (inside UpdatePanel1)

datalist2 (outside UpdatePanel1)

I have a ImageButton inside the datalist2 & when it is clicked, in the datalist2_ItemCommand event, I am updating some information in the database & calling a DataBind() on datalist1 & then calling an Update() method of UpdatePanel1.

This works fine, but my problem is that because of the datalist2_ItemCommand getting fired, a full postback occurs as well. How do I avoid this? I just want the datalist1 to be refreshed inside the UpdatePanel & not refresh the datalist2 at all.

If I use Web Service method, then I can do the database update in it, but I am unable to access the datalist1 to rebind it and also the UpdatePanel1 to update it.

Can someone please help me.

Thanks

Hi,

You canregister theItemCommand event ofdatalist2as a trigger of the UpdatePanel in whichdatalist1 is contained.

<Triggers>
<asp:AsyncPostBackTrigger ControlID="DataList1" EventName="ItemCommand" />
</Triggers>

Best Regards,


I had logged this issue in another forum my mistake and it got moved in this forum only after I logged it again as a new post (link below):

http://forums.asp.net/p/1180380/2000803.aspx#2000803

Thanks for your help.

Calling a server side method from javascript without page methods

Hi everyone.

I'm trying to do some like this:

if (confirm("foo") == true) {

MyServerSideFunction();

}

Of course, I can call this function using PageMethods, but since this function in my code behind shold be static, I cannot call others methods inside my class.

Is there any way to call serer side methods without using PageMethods?

Thanks, and sorry for my bad english!

You can use ajax to call a webservice from javascript. Check out this article on how to do it:http://www.semenoff.dk/en/Code-Corner/ASP.Net.AJAX/WebService-From-JavaScript.aspx

Hope it helps


__doPostBack("ServerEventNameHere","");


Hi Everyone :)

@.Klaus Byskov Pedersen

I alread tryed using web services and it works fine, but it's not the case.

@.rpack79

Nice! It works! I noticed that I had to catch this requent inside my OnPageLoad and call the appropriated methods. Now one more question: And if I want do catch this postback inside an WebControl? Actualy I'm catching the postback event inside my control's OnInit event. Is it the right way?

Thanks a lot by the answers.

Calling a Page Method Instead of a Web service method with javascript?

Hi All,

I am just wondering if it is possible to call a page method or a static method (non webservice) with javascript and have it return the results to the calling javascript funciton just like how it is done with a webservice call? Personally I prefer not to be producing asmx's for things that may only be used on a single page.

If so ... how might I accomplish this?

If Not.... Why not?

hehe

Thanks

Hi miskiw

Yes you can do that, you can find details here

http://ajax.asp.net/docs/tutorials/useWebServiceProxy.aspx at the bottom of the page titled "To call a static page method".

It is worth noting that there is a bug with this in the current release where you can only call methods that are inline. You cannot currently make async calls to methods that are in code behind.

HTH

Andy.


http://ajax.asp.net/docs/tutorials/useWebServiceProxy.aspx

can't open.

can you give a sample?THX


The new address is:http://ajax.asp.net/docs/tutorials/ExposingWebServicesToAJAXTutorial.aspx
In the bottom of the page, you have the section Exposing Web Services from an ASP.NET Web Page.

Basically, what you need to do is to create a static method and apply the [WebMethod] attribute to it.

[WebMethod]public static string EchoString(string name) {return"Called by " + name +".";}
HTH,
Maíra

Monday, March 26, 2012

callBaseMethod

hi,

I have a base class and another class inherit from it. How do I call a method with parameter in the base class?

so far, i've seen example where you can call the base method like so

callBaseMethod(this,'[methodname]');

but my methodname in the baseclass has parameters, i need to pass values into
it when i call.

any advice is appreicated.

thanks

You can do it like so:

callBaseMethod(this, {method_name},[Array_of_values_to_pass]);

so, copying from one of the supplied javascript files, here is an example:

callBaseMethod(this, 'set_ClientState',[value]);

This calls the'set_ClientState' property (which is really a method/function), passing the variable 'value' as a parameter.


Hi Glav,

Thanks!! Really really appreicate that. It works :)

Liming

Callback for dynamic populate control

When I call the populate method of dynamicpopulator control it calls the method as set in the ServiceMethod property.

How do i know when this method has completed execution so that I could perform some other task.

Is there a callback that I can access that tells me that the populate method has completed?

Please advise.

There might be a way to access the callback handler of the webservice proxy that gets invoked, but I'd say that an easier way would be to use the CustomScript property to call a function of your own design which returns to a handler you set up to do what you're looking for.

Call Webservice method which takes two paramete

Hi Everyone:

I am new to Atlas World and this is my first post.I have two question

1. I create a simple webservice which has a GetMemberDetail method as below

[

WebMethod]publicstring[] GetMemberDetail(string searchCriteria)

{

try

{

string SQL ="select member_id,first_name,last_name from table where client_id = 1111 and upper(last_name) like 'XXX%'";

SQL = SQL.Replace(

"XXX", searchCriteria.ToUpper());OracleDataReader dr =OracleHelper.ExecuteReader(cn,CommandType.Text, SQL);List<string> suggestions =newList<string>();while (dr.Read())

{

suggestions.Add(dr[2].ToString());

}

return suggestions.ToArray();

}

catch (Exception ex)

{

string mess = ex.Message.ToString();throw;

}

}

and in aspx page i have

<asp:TextBoxID="myText"runat="server"></asp:TextBox><atlas:AutoCompleteExtenderID="abc"runat="server"><atlas:AutoCompletePropertiesEnabled="true"MinimumPrefixLength="3"ServicePath="AutoCompletion.asmx"ServiceMethod="GetMemberDetail"TargetControlID="myText"/></atlas:AutoCompleteExtender>

When i run the application, parameter[searchCriteria] being passed to webservice is become a null .

Can anyone please tell if i am missing something.

Question No: 2 If i want to call a method from WebService which takes two parametes like ClientID and searchCriteria.How Can i do it ?

Please help .

Thanks,

Pargat

Hi,

regarding the AutoCompleteExtender,
1) the serviceMethod must be a method that accepts two arguments; these arguments have to be exactly named:prefixTextandcount and they must be strings. The first argument contains the text typed in the TextBox while the second is the number of results to be returned.
2) it's not possible to pass other parameters to the AutoComplete method.

Thanks .Is there any way i can use this functionality.My requirement is to pass clientID and search string [last name] and return back array that match the search criteria.

Pargat


Hi,

you can't do it at the moment with the Atlas auto-complete stuff. If I remember correctly, someone posted a custom auto-complete class that handles multiple parameters, but I think it relies on a previous Atlas release (anyway at the moment I can't find that thread).

Call webmethod in page possible

I thought it was possible to call a public method with the attribute [WebMethod()] above it. But when I try out the sample of the AutoCompleteExtender it works perfectly when I put the code in a webservice (.asmx). Unfortunately when I put the same code in my default.aspx page it doesn't work.

I changed the ServicePath to ="Default.aspx" but that doesn't seem to do the trick.

So does anyone have a clue here what I'm doing wrong?Hi,

at the moment the auto complete stuff works only with a web service. Page methods are not supported.
However, do a search in this forum since a user (I can't remember the name, sorry) has coded a custom version that supports page methods.

Jay Kimble is your man.

http://david.codebetter.com/blogs/jay.kimble/archive/2006/07/17/147436.aspx


The auto complete extender in my library also supports this.

Call the method bound to an linkbutton after ajax callback

Hi everybody

I just have the following problem:

I created a ASP-LinkButton and added a method in the code-behind file for its onclick event. Then I added a break point at the beginning of the method to check if it's called.

Now I added a JS which calls the __doPostback("xxx", ""); exactly like the LinkButton does and everything works fine.

Now I add a Webservice, which validates my input and if everything works fine, its callback should call the click method of the asp-button. Guess what happens: the postback is called, but not the event of the button. If I do this before outside the callback - everything works fine, so I know the code is correct.

I even tried to add a "window.setInterval" timer which always checks a bool and calls the postback as soon as the bool is turned to true ... Then I set the bool after the callback and guess again: The postback is called but not the method ...

I don't have any further ideas for workarounds - anyone got a hint for me?

THANKS!

Hi,

Now I get a general idea of your situation. But your description doesn't give me sufficient information to find the cause.

Accordingly, I made a sample, please try it.

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %><!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>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services><asp:ServiceReference Path="WebService.asmx" InlineScript="true" /> </Services> </asp:ScriptManager> <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton></div> </form> <script type="text/javascript"> var count = 0; function callBack(result) { if(result) __doPostBack('LinkButton1',''); } function callWS() { count++; WebService.ShouldCallBack(count, callBack); } window.setInterval(callWS, 2000); </script></body></html>
using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partialclass Default3 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) { }protected void LinkButton1_Click(object sender, EventArgs e) { Response.Write("Linkbutton is clicked on " + DateTime.Now.ToString()); }}

<%@. WebService Language="C#" Class="WebService" %>using System;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.Web.Script.Services.ScriptService]public class WebService : System.Web.Services.WebService { [WebMethod] public bool ShouldCallBack(int count) { return count == 5; } }
Hope this helps.

Call Server Side method from JavaScript function in Master Page

I have a JavaScript function in a Master Page. The function is below.

function Add(q, p) {//call server side method }

I want to be able from within the JavaScript Add function defined above, call a C# server side method and pass the values q and p to it. No value is returned.

I have tried PageMethods.CallServerSideMethod(q, p); but it will only work in a Page, not a master page.

Is there any way I can do this in a master page?

How about using a web service call?

Thanks for your help.

How could i code that? An example maybe?


The documentation has pretty good code examples. See if this helps: http://www.asp.net/AJAX/Documentation/Live/tutorials/ExposingWebServicesToAJAXTutorial.aspx

Niall20:

it will only work in a Page, not a master page.

That's because .master file can't work as a httpHandler to server the request. It's blocked. In a simple word, the method in master page can't be accessed from client side directly.

Call method of Master page from Update panel

Hi,

How to call the method of master page from the UpdatePanel. Do I need to write a trigger? Provide the syntax.

Calling your master page from an update panel is no different from doing it on a "normal" page. All you need to make sure is that you have added a reference to your MasterType in your aspx code:

<%@. MasterType VirtualPath="~/MasterPage.master" %>
Then you can do Master.SomeMethod() from your page.

Hi,

Thanks the above code is already added. I have implemented the same, it is woring fine for the controls outside the Update panel. Same method call is not supported from update panel.

Jist of what I am looking at:

I want to display a message in the master page, which is a UserControl. I am facing the problem in invoking a method of UserControl in Master page from child page, all the controls in child page are embaded in the UpdatePanel.

Can you provide the syntax for the same

How the following line of code can help me?

ScriptManager.GetCurrent(this.Page).RegisterAsyncPostBackControl( );


Hi,

Thank you for your post!

To invoke a method of UserControl in Master page from child page? or fire an event of the UserControl?

Invoke a method of UserControl in Master page from child page lkike this!

UserControl uc = ((UserControl)Master.FindControl("uc1"));
uc.yourmethod();

If you have further questions, let me know.

Best Regards,

Call JS at end of UpdatePanels content loading

I'm trying to figure out how to call a javascript method at the end of an UpdatePanel's content reloading. I know this must be possible, but I'm not seeing how yet.

Here's what I have: one page with an update panel. Contained within the update panel is a series of controls, much like a wizard. Each control has a button that posts back to the server, which then loads a different control. By using the UpdatePanel, the postback is hidden, which is nice. What I want is for every time the control within the UpdatePanel is changed for some custom javascript to run. The script just resets a page-scoped timer that notifies the user his session is about to expire. How can I hook in to the postback and run my one line of script? Thanks.

Of course after hours of searching and posting I finally find an example using the PageRequestManager that does the trick nicely. For the record, the simple script was:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{ extendSession();// My JS method }

Saturday, March 24, 2012

call Function after modalPopup

I need some advice on how to call functions after a modalPopup is shown.

I am using the modalpopup1.show() method to show the popup window. However, the prolem I am having is the popup is not visible until it reaches the end of the routine.

example: The Button1.Click event calls the modalpopup1.show() method:

Private Sub Button1_Click(ByVal Sender... etc... .etc...)
DoSomeThings()

modalPopup1.Show() -- a textbox is filled based on what the user selects from the modalPopup Window, and that value is sent to a function

DoSomeMoreThings(textBox.text)

Sub

The problem is that the DoSomeMoreThings(string) function is called before the ModalPopup window appears, so when the DoSomeMOreThings() Function is called, the textbox is empty (The textbox is filled by the value selected by the user in the modalpopup)

How i get the popupt to show, get the value and then continue?

Thanks

Not sure if this will help you or not, but you can use JavaScript's setTimeout(...) to delay the call to "DoSomeMoreThings"

-Damien


Hi,

Put a button 'Continue' in your modal popup. Let user hit this button after he complete input for textBox.text. Then in OnClick event of 'Continue' button call your function.


Maybe I mis-understand, but I don't think so because I need the modalPopup to pop, get the user selection and then procede to the DoSomeMoreThings.

One think I thought of was to call the function from the client. But i'm not sure how to call a function in the code behind page from the client. Is this possible?


Just to clarify: The application does not stop at the modalPopup.show() method and wait for a response.

So, lets say i've got three button in the ModalPopup window: Button1, Button2, Button3.

If you click Button1, then, back in the main page, the textbox fills with Button1. Etc... for Button2, Button3.

Then, a function is called to set the text of a label to what you selected:

ModalPopup.Show()

GetLabelText(TextBox1.text)

Sub GetlabelText(ByVal str as String)
label1.text = "You Selected " & Str
End Sub

What is happening is when I run it, and say, click button 1, the page displays Button1 in the textbox, and the Label says "You Selected ". How can I make it wait after the modalPopup.Show() until the user makes a selection, before continuing on to GetLabelText()?


I'm sorry, but I really don't understand what you are trying to do. Can't you just call ModalPopup.Show() on the onchange or onblur of the TextBox?

-Damien


Or do it as Viktar suggested, call GetLabelText method in the onclick event handler of Button1, 2, 3.


I've run into this, and worked around it, by putting the content of the modal popup inside an updatepanel, and forcing a .Update() on it before you DoSomeMoreThings(textbox.text).. That way, you will get the new textbox value.

Call AJAX method from code behind page

Hi,I need to call an AJAX method from code behind page; is there any way to do that? if it can be done by calling a javascript function from code behind page, also helpsI'm coding in ASP C# .NETAny idea is appreciated

this code solved my problem:
string s = "<script type='text/javascript'>test();</script>";

ClientScript.RegisterStartupScript(Page.GetType(), "test", s);

while I have such function in my javascript code:

function test()
{
..
}