1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / simple user control with data access

simple user control with data access

5 posts, 0 answered
  1. Kutay
    Kutay avatar
    18 posts
    Registered:
    21 Apr 2009
    02 Jun 2009
    Link to this post
    Hello,

    I need to develop a custom user control which has a grid on it, and when the user clicks on one of the items, he's directed to a detail page. But the list is not static, it's populated with items that are the result of a database query. What is the best practice here? If I implement this feature using a user control, am I forced to include the code that fetches the data in the user control code behind, or is there some other way of putting the code that accesses the data in a separate, helper file?

    Need your opinions on this, especially the telerik team.

    Thank you in advance.

    Best regards, 
  2. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    03 Jun 2009
    Link to this post
    Hi Kutay,

    You will find that there are absolutely no restrictions with what you want. So you have the choice to do it however you please.

    Usercontrols in Sitefinity work exactly how they would in any other ASP.Net Application so if you want to do everything in the codebehind of the UserControl you can.  Or if you want to have a separate Data Access Layer or use webservices you can go whatever way you want..

    As a bonus because the RadControls are included most of them support the use of ClientSide databinding like webservices.

    Cheers
    Sean
  3. Kutay
    Kutay avatar
    18 posts
    Registered:
    21 Apr 2009
    03 Jun 2009
    Link to this post
    Thank you for the reply Sean.

    So, let's say I want to separate the data layer... When I'm uploading the control from the sitefinity interface, it only asks me for the .ascx and .ascx.cs files. How do I upload the files in the data layer?

    Thank you.
  4. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    03 Jun 2009
    Link to this post
    Hi Kutay,

    I develop my website on my development machine before uploading so I am not sure how you do it.

    But if you are the same then you can just add the files into your project wherever they are on your computer. 

    If the files are on a hosting server somewhere then you could FTP the files? Or you can use the Files section in Sitefinity which gives you full control of uploading files to your project.

    Cheers
    Sean
  5. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    04 Jun 2009
    Link to this post
    Hi Kutay,

    What you need is data binding. Once your DAL is done (most probably you are using the Sitefinity API for this), you can do some client-side data binding to impress your clients.

    If you want to know more about Sitefinity, you should definitely read the documentation outline on Ivan's blog.

    Usually, we document new things on the blogs, forums or KB articles, as they immediately go live and you can read them right away. You might want to check out Gabe's blog as well, as he is very actively involved.

    Your custom controls (in the form of .dll files) are usually uploaded the bin sub-directory of your web site. You might want to read about adding custom controls or modules to Sitefinity.

    Greetings,
    Dido
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
5 posts, 0 answered