How to Pass UserName to ObjectDateSource?

  • Thread starter Thread starter Dot Net Daddy
  • Start date Start date
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
 
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

Back
Top