About Database access

5 posts, 0 answers
  1. Mugil
    Mugil avatar
    21 posts
    Member since:
    Mar 2013

    Posted 12 Mar 2013 Link to this post

    HI 


       I have two login like admin and user.my doubt is when i login as admin the grid want to show hole record in the database but when i login as user it want to show particular record for that user how it ll be done..this is my doubt if somebody give solution for this
  2. Mugil
    Mugil avatar
    21 posts
    Member since:
    Mar 2013

    Posted 12 Mar 2013 Link to this post

    can anyone give solution for this asap
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eyup
    Admin
    Eyup avatar
    3012 posts

    Posted 15 Mar 2013 Link to this post

    Hi Mugil,

    You can use Advanced data-binding to achieve the requested functionality:
    http://www.telerik.com/help/aspnet-ajax/grid-advanced-data-binding.html
    protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        if (true) // user has full access
        {
            RadGrid1.DataSource = GetFullDataMethodName();
        }
        else
        {
            RadGrid1.DataSource = GetLimitedDataMethodName();
        }
    }

    Hope this helps. Please give it a try and let me know if it works for you.

    All the best,
    Eyup
    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.
  5. Mugil
    Mugil avatar
    21 posts
    Member since:
    Mar 2013

    Posted 15 Mar 2013 Link to this post

    HI Eyup,

                 Thank you for your reply
                 If u don't mind  can u explain it clearly because im new to this.



       thanking you,
     
      P.Mugil
  6. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 18 Mar 2013 Link to this post

    Hi Mugil,

    In the if statement you should place logic that checks whether the user is an admin or not. If the user is an admin then the GetFullDataMethodName method will be called. This method should return the whole set of records from the database. If the user however is not an admin you should implement logic inside the GetLimitedDataMethodName method which should extract and return a concrete set of data that meets you requirements.

    Note that RadGrid.DataSource excepts an object. The only requirement is that the custom object to which the grid will be bound should implement the ITypedList/IEnumarable/ICustomTypeDescriptor interfaces.

    Regards,
    Angel Petrov
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017