Welcome Guest Search | Active Topics | Sign In | Register

Call back panel: client side javascript: alert box Options
RAM
Posted: Wednesday, April 16, 2008 7:41:23 AM
Rank: Member
Groups: Member

Joined: 4/8/2008
Posts: 19
I am using a grid view control inside another grid view. The internal grid view has sorting capability. Recently I used callback panel for the internal grid view control.

Earliar I used to show the clientside alert box when ever user click on a row on the internal grid view. i used the following code in the code behind

protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{
GridView _gridView = (GridView)sender;
XXXInfo vio = new XXXInfo();
vio = vioDao.GetById(int.Parse(_gridView.SelectedValue.ToString()));
Response.Write("<script>window.alert('Oops ! Only controller(" + vio.Name + ") or manager/supervisor has permissions on this row');</script>");
}

After using this callback panel this code is not working.


I tried with other property

ClientSideAfterExecute="DisplayMsg"

and client side script is ...

function DisplayMsg(callback)
{

var v = callback.getEventTarget();

if (evtTarget.indexOf("??????") >= 0)
{
alert("This is a row click not a header click");
alert(''Oops ! Only controller(" + vio.Name + ") or manager/supervisor has permissions on this row");
}
}


PROBLEM: The above function is being called when I click on the header of the gridview for the sorting pupose. I only need this to be called when I click on a row.


Question: How can I distingush between a row click and a heder click? what can be replaced ??????? in if (evtTarget.indexOf("??????") >= 0) ?
RAM
Posted: Wednesday, April 16, 2008 7:44:26 AM
Rank: Member
Groups: Member

Joined: 4/8/2008
Posts: 19
Please suggest if any other way is possible to achive this .....

Thanks
RAM
eo_support
Posted: Wednesday, April 16, 2008 7:47:16 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

Put an asp:Label inside the CallbackPanel, then change the Label's Text property:

Label1.Text = "<script type='text/javascript'>window.alert('hi!')</script>";

That is pretty much the equivalent of Response.Write for CallbackPanel. Note that the Label has to be inside the CallbackPanel so that the newly generated script will be ferried to the client side.

Thanks
RAM
Posted: Wednesday, April 16, 2008 2:37:25 PM
Rank: Member
Groups: Member

Joined: 4/8/2008
Posts: 19
Thanks ... it worked


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.