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

Opening a RadWindow from a RadGrid item click?

3 Answers 152 Views
Window
This is a migrated thread and some comments may be shown as answers.
Miklos
Top achievements
Rank 1
Miklos asked on 18 Jun 2008, 10:02 PM
Hi,

Is it possible to open a RadWindow when I click an item on the RadGrid even by adding a link inside? I did have a solution but it reloads the page and its very sloppy.

The way I did it was that I added the following in my aspx:

 <telerik:GridHyperLinkColumn DataTextFormatString="Edit Item"
        avigateUrlFields="country_id" UniqueName="country_id"         DataNavigateUrlFormatString="~/admin/AdmCountries.aspx?edit_id={0}"
                        HeaderText="Edit Item" DataTextField="country_id" >
        </telerik:GridHyperLinkColumn>

then I updated my codebehind's OnPageLoad like this:
           
       
 string editID = Request.QueryString["edit_id"];
 
if (editID != null)
{
  RadWindowManager1.Windows[0].VisibleOnPageLoad = 
true;
} else {
  RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
}


So essentially reloading the page with the ID parameter and if it is set then the window is displayed. What I would like instead is not to have a postback, rather displaying the window with a given ID, maybe using AJAX.

I am new to this great product and would like to get the hang of it, please help.

Thanks,
Miklos

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 19 Jun 2008, 10:52 AM
Hello Miklos,

I believe that the Window Editing demo will be of help. Please use the code as a base and extend it further to fit your requirements.



Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Darin
Top achievements
Rank 1
answered on 19 Jun 2011, 08:48 PM
The example is really unhelpful.  Where does the ShowEditForm() js function ever get referenced in an onclick call from the Hyperlink object?
0
Shinu
Top achievements
Rank 2
answered on 20 Jun 2011, 11:36 AM
Hello Darin,

The onclick event is attatching from code behind. Check the DefaultCS.aspx.cs page also from the demo.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink");
                editLink.Attributes["href"] = "#";
                editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"], e.Item.ItemIndex);
            }
        }

Hope it helps.

Thanks,
Shinu.
Tags
Window
Asked by
Miklos
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Darin
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or