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) ?
|
Rank: Member Groups: Member
Joined: 4/8/2008 Posts: 19
|
Please suggest if any other way is possible to achive this .....
Thanks RAM
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
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
|
Rank: Member Groups: Member
Joined: 4/8/2008 Posts: 19
|
Thanks ... it worked
|