Showing posts with label box. Show all posts
Showing posts with label box. Show all posts

Monday, March 26, 2012

How do I display a simple message box using Ajax?

I'm doing a check to make sure that at least one out of 5 search text fields are entered. If none are entered, I want to display a message saying so. How do I do this?

The following works if I do not use Ajax:

DisplayClientError("My message to be displayed here");

privatevoid DisplayClientError(string errorDesc)

{

string script ="<script language=\"javascript\">alert('" + errorDesc +"');</script>";ClientScript.RegisterStartupScript(typeof(Page),"UserSecurity", script);

}

But this doesn't show up in Ajax version.

Thanks.

Use ScriptManager.RegisterStartupScript() instead.


Try this

privatevoid DisplayClientError(string errorDesc)

{

string script ="alert('" + errorDesc +"');";

ScriptManager.RegisterStartupScript(this,typeof(Page),"UserSecurity", script,true);

}


Oh !!!! I see what's happening now. Thanks a lot.


thx for that !!Smile

Saturday, March 24, 2012

how do I access data on client side with ajax

hello. I have an mdb that I want to use to popluate some textboxes with out postback or waiting for IE to reload.

I am using easylist box that gives me the record ID but I want to use that ID to pull data from the MDB with out reloading the IE.

can someone link me in the right direction?

You should issue XmlHttpRequest on some Javascript event (say, button click or focus removed or whatever), which will pass your ID to the server side and will get the response, which you should dynamically insert into the TextBox you want (javascript, client side again).

This is th schema in general.

You can find a lot of free books about AJAX on the net, ex.: http://paperolli.com/default.aspx?keyword=ajax


thanks!!!

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

Wednesday, March 21, 2012

How can i give alert box when one row from gridview is deleted (gridview is inside a updat

How can i give alert box when one row from gridview is deleted (gridview is inside a updatepanel)...... Please help me.....

Hi,

try to:

1. Hook up the RowDeleted event of the GridView.

2. Inject the following JavaScript using the ScriptManager.RegisterStartupScript method:

(function() { var fn = function() { alert('Row Deleted!'); Sys.Application.remove_load(fn); } Sys.Application.add_load(fn); })();

I can't understand that...how i give this? from where i call that function?


Hi,

You need to place a timer in the UpdatePanel, and use it to check if a row has been deleted.

When it's true, use ScriptManager.RegisterStartupScript method to register a client script and show a alert.

Hope this gives you a basic idea.