1
Answer

C# current.principal

Sie Ste

Sie Ste

12y
1.7k
1

In a current C# 2008 application, the current logic determines if a user has access to certain roles by using the following kind of check:
IPrincipal ip = Thread.CurrentPrincipal;
bool isInRole = ip.IsInRole("managers");

Now my company is going to use several different domains. For the logic
I listed above, would I need to use logic like
 if (ip.IsInRole("domainname1/managers") || 
    ip.IsInRole("domainname2/managers") ||
    ip.IsInRole("domainname3/managers"))

,can I use logic that does not require the domain name, or do you have a suggestion on what I can try?
 Thus can you show me in code or tell me how to accomplish my goal?

Answers (1)
0
Ankit Sharma

Ankit Sharma

NA 8.8k 141k 7y
Hi kalyan
 
Please refer to this link
 
https://stackoverflow.com/questions/15129665/how-to-get-the-count-of-records-in-the-datasource-of-the-gridview 
Accepted
0
Gautam Parmar

Gautam Parmar

NA 872 2.2k 7y
Hi Kalyan,
 You may try below code whether it is paging or not once row will bind it will count...
  1. int totalRow= 0;      
  2. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)      
  3. {      
  4.     if (e.Row.RowType == DataControlRowType.DataRow)      
  5.     {      
  6.         totalRow+=1;  
  7.     }      
  8.       
  9. }