How to Pass UserName to ObjectDateSource?

D

Dot Net Daddy

Hello,

I need to pass the username to object data source. But I failed. As a
parameter I passed Profile("UserName"), but it doesnt work. At the
moment I am passing it via a control (HiddenField), but I know it is
unsecure.

I read somewhere that I need to add some code in web.config. But they
didn't tell what to add. If anyone know, please let me know. Thank you
 
G

Guest

Hello,
You can achieve your need by adding similar code as the following in Page
Load event:

ObjectDataSource1.SelectParameters["ParamName"].DefaultValue =
User.Identity.Name;

--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top