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

About Database access

4 Answers 44 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mugil
Top achievements
Rank 1
Mugil asked on 12 Mar 2013, 05:57 PM
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

4 Answers, 1 is accepted

Sort by
0
Mugil
Top achievements
Rank 1
answered on 12 Mar 2013, 06:27 PM
can anyone give solution for this asap
0
Eyup
Telerik team
answered on 15 Mar 2013, 08:31 AM
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.
0
Mugil
Top achievements
Rank 1
answered on 15 Mar 2013, 01:59 PM
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
0
Angel Petrov
Telerik team
answered on 18 Mar 2013, 04:21 PM
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.
Tags
General Discussions
Asked by
Mugil
Top achievements
Rank 1
Answers by
Mugil
Top achievements
Rank 1
Eyup
Telerik team
Angel Petrov
Telerik team
Share this question
or