This is a migrated thread and some comments may be shown as answers.

Select value from RadGrid onmouseover

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trent
Top achievements
Rank 2
Trent asked on 15 Oct 2011, 10:24 AM
Hello Telerik Team,

I would like to first thank you for a constant and high quality product.

I have a RadGrid that is grouped with custom fields, I am currently opening RadWindows from the ImageButton click events like so:
protected void Play_Click(object sender, ImageClickEventArgs e)
{
    Geek.XTV7_Time_Start = DateTime.Now.ToString();
 
    string sql = "";
    var dt = new DataTable();
    sql += " Select ISNull( XTV7_VideoHits, 0) AS XTV7_VideoHits From Xtrain.XTV7_2_Videos WHERE  (XTV7_Videos_ID=" + Geek.XTV7_Videos_ID.ToString() + ")";
 
        dt = data.GetDataTable(sql);
        Geek.XTV7_VideoHits = (Int32.Parse(dt.Rows[0]["XTV7_VideoHits"].ToString()) + 1).ToString();
        VidHit();
 
        RadAjaxManager1.ResponseScripts.Add("radopen('Forms/View/VideoViewer.aspx','RadWindow1')");
 
}

 to open a RadWindow (depending on what button, as each button has its own windows via a RadWindow Manager) after passing a session variable via my session handler Geek.XTV7_Videos_ID from the SelectedValue. (this code is used to get the id and pass it to the session variable:

protected void RadGrid_ItemCommand(object source, GridCommandEventArgs e)
{
 
    if ((e.Item is GridDataItem) && (e.CommandName == "Select"))
    {
        var item = (GridDataItem)e.Item;
        string gvDataKey = item.GetDataKeyValue("XTV7_Videos_ID").ToString();
        Geek.XTV7_Videos_ID = gvDataKey;
    }
}

)

Then on RadWindowClose() there is a value written to the DataBase to reflect the hits, the window close method initiates the folowing code to refresh the grid and send update command to the DB:

videoselector.ascx.cs
#region Ajax Manager Request
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    switch (e.Argument)
    {
        case "closed":
            UpdateView();
            RadGrid1.Rebind();
            break;
    }
}
#endregion

videoselector.ascx
function onClose() {
    $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("closed");
}
function RowSelected(row) {
}

sorry for the long intro but I need to be sure that the environment is understood.

THE PROBLEM:
we need to be able to pass a variable to Geek.XTV7_Videos_ID on mouse over and refresh or instantiate an AJAX request on the panel shown in the attached image (without breaking existing methods and events).
How would I go about this?

Thank you very much in advance.

Trent

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 18 Oct 2011, 01:59 PM
Hi Trent,

You can go about achieving your requirement by using again the ajaxRequst method of the RadAjaxManager client-side component.

Here are the steps:

1. Add to the ClientDataKeyNames property of the grid the name of the field in question: XTV7_Videos_ID

2. Attach a client-side event handler to the OnRowMouseOver event of the grid.

3. In the client-side event handler get the XTV7_Videos_ID or any other information using the RadGrid's client-side  API and the event arguments object that is sent into the mouse-over handler.

4. Send the information you have obtained through an ajax request to the server.

5. Add an ajax setting to the RadAjaxManager control where RadAjaxManager is the updating control and the panel is the updated one.

Hope it helps.

Regards,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Trent
Top achievements
Rank 2
Answers by
Tsvetoslav
Telerik team
Share this question
or