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

RadGrid Read-Only View

9 Answers 848 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Albert
Top achievements
Rank 1
Albert asked on 06 Jan 2012, 03:00 PM
Hi,

I have used the edit template in the radgrid to create a custom insert/edit form in the grid.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/templateformupdate/defaultcs.aspx

how do I add a select button to the grid and display a custom read-only view in the grid?

Regards

9 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 09 Jan 2012, 05:29 PM
Albert:

The instructions for adding a "SELECT"/"DESELECT" button to a RadGrid is covered on the Selecting a Row with a Select Button (Server-side) documentation page.

I'm not sure what you mean by "read-only" view. If you have an Edit button on your grid, I don't think this is possible.

Please provide more insight into your requirement.

Cheers!
0
Albert
Top achievements
Rank 1
answered on 09 Jan 2012, 10:57 PM
Hi,

The behaviour I am looking for is similar to the Microsoft FormView read-only view.

I need the user to click a button on the RadGrid row and then details of that record are displayed but not editable, currently I have a button for editing that displays a Form Template in the grid (this allows me to arrange the controls the way I want for editing), but I can't see how to create a Form Template just for displaying the details of the current record.

Regards
0
Richard
Top achievements
Rank 1
answered on 10 Jan 2012, 04:22 PM
Albert:

Have you taken a look at the Preview(ReadOnly) Option for WebUserControl Edit Form documentation page for RadGrid? Would this present a possible solution?

Regards,
0
Albert
Top achievements
Rank 1
answered on 17 Jan 2012, 06:20 PM
Hi,

Not really, I am using the "Template" method for the edit form as in the example below:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/templateformupdate/defaultcs.aspx

I need to be able to have a custom form (just like above sample) that is read only using templates, is this not possible?

Regards
0
Pavlina
Telerik team
answered on 21 Jan 2012, 10:13 AM
Hello Albert ,

You can examine the following online demo which demonstrates how you can display details for the product name on mouse over.
http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=grid

Give it a try and see if it works for you.

Regards,
Pavlina
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
0
Albert
Top achievements
Rank 1
answered on 22 Jan 2012, 03:47 PM
Hi,

Thank you for your response. It is close to what I am after, but I would prefer the read-only view to be in the grid rather than as a pop-up, just like the edit form.

Is this possible with the RadGrid? If so, how?

Regards

0
Accepted
Pavlina
Telerik team
answered on 23 Jan 2012, 01:16 PM
Hi,

After you prefer the read-only view to be in the grid like edit form you can use the logic from Preview(ReadOnly) option for WebUserControl edit form which is also applicable for the FormTemplate edit form.

Regards,
Pavlina
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
0
Albert
Top achievements
Rank 1
answered on 24 Jan 2012, 03:25 PM
Hi Pavlina,

Thank you for your help, yes I can see how this could be the answer, but could you show me the code I need to adapt the code for the FormTemplate i.e. how do I change this code to call each control in the FormTemplate instead of a web control:

private void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == "Preview")
    {
        e.Item.Edit = true;
        e.Item.OwnerTableView.Rebind();
        GridDataItem editItem = e.Item.OwnerTableView.Items[e.Item.ItemIndex];
        *************** This Code *************************************************************************
        string ucID = GridEditFormItem.EditFormUserControlID as string;
        EmployeeDetailsVB MyUserControl = editItem.EditFormItem.FindControl(ucID) as EmployeeDetailsVB;
        MyUserControl.SetPreviewMode();
        *****************************************************************************************************

    }
}

Regards
0
Accepted
Pavlina
Telerik team
answered on 30 Jan 2012, 07:00 PM
Hello,

You could try to access controls from grid edit form as shown below:
GridEditFormItem editform = (GridEditFormItem)e.Item;
TextBox txt = (TextBox)editform.FindControl("TextBoxID");

set preview mode for them and let me know how it goes.

Regards,
Pavlina
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
Albert
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Albert
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or