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

UserControlName path?

4 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tree
Top achievements
Rank 1
Tree asked on 18 Feb 2008, 10:11 PM
I'm trying to debug my RadGrid that is intended to use a User Controls for inserting & editing records.

Whenever I click the Add Record command button, the whole grid disappears.  I've looked at the rendered HTML and all I see is a wrapper for the grid.  Everything else disappears.

I was wondering if it was related to my User Control so I did an experiement and put a purposely invalid name for the UserControlName attribute of the EditFormSettings tag.  To my surprise the code ran without any exception being thrown.

1. Isn't there any check done in the internal code of RadGrid to confirm that it has loaded the User Control?
2. My RadGrid is in an ASCX of its own which is located in a second level folder of the website.  The ASCX for the Edit Form is located in the same directory.  What path name do I put for the UserControlName attribute?  I was thinking "~\Controls\editformUserControl.ascx".  Is that correct?

To be clearer, here is the structure of the page:

\
    wrapperPage.aspx
    \Controls
        parentUserControl.ascx
        editformUserControl.ascx

WrapperPage contains a user control named parentUserControl.ascx which in turn contains the RadGrid.  That RadGrid wants to use an edit form implemented in editformUserControl.ascx.

4 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 19 Feb 2008, 01:39 PM
Hi Eriksson,

RadGrid will throw an exception if it tries to load a user control that does not exist. The reason for not throwing it in this case is that it does not even try to load that user control. The grid disappearing looks like it has not been provided with datasource. Do you databind the grid when editing a record? I recommend checking these help topics related to RadGrid databinding:

As for the web user control name -- as long as it is in the same folder with RadGrid you can use UserControlName="editformUserControl.ascx".

Greetings,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Tree
Top achievements
Rank 1
answered on 19 Feb 2008, 01:47 PM
Thank you.  I'll look into the datasource thing.

As for the user control path, are you saying that the name should be RELATIVE to the file containing the RadGrid?  Will it not understand the ASP ~ prefix?  I ask because it may happen that the RadGrid MAY NOT be in the same folder as the edit form user control.
0
Ves
Telerik team
answered on 19 Feb 2008, 02:04 PM
Hi,

My answer was focused on the specific details you provided. RadGrid will understand UserControlName="~/Controls/editformUserControl.ascx"

Regards,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Tree
Top achievements
Rank 1
answered on 19 Feb 2008, 02:45 PM
Thanks!  Great support as always.
Tags
Grid
Asked by
Tree
Top achievements
Rank 1
Answers by
Ves
Telerik team
Tree
Top achievements
Rank 1
Share this question
or