How to pass logged in user name as SqlParameter in ASP.NET

In the scenario i have a gridview, which should contain the data based on current logged in user. The main challenge, i was facing how to pass current login user name to the Sqlparameter. After a little research i got a wonderful solution which is worked - 

Step 1- Defined select parameter in "<asp:SqlDataSource" as 








Step 2- In page load write the below code -















This work perfect for me, Please provide your comment if you got something better.

Post a Comment

0 Comments