Click here to Skip to main content
11,704,768 members (59,398 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET ADO.NET
I am working on real estate web portal. I want to show posted ad in a grid view according to a login person for example:- if a person "A" is login on website and has posted some ads then if "A" want to show own ad. I want to do this.


Give me some clues...


Thanks in advance.
Posted 17-Nov-12 22:36pm
Comments
Krunal R at 18-Nov-12 4:46am
   
which means you only person "A" have all rights for that ad and other can only see.. Am I right ?
SURBHI TYAGI at 18-Nov-12 5:00am
   
no u r wrong...for everyone whoever login on site.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I have solved it.Smile | :)
on page load using this code.
protected void Page_Load(object sender, EventArgs e)
{
   SqlCommand SelectCommand = new SqlCommand("select Id,Title,owner from PostAd1 where owner=@owner",conn);
   SelectCommand.Parameters.Add("@owner", SqlDbType.NVarChar);
   SelectCommand.Parameters[0].Value = Convert.ToString(Session["username"].ToString());
   SqlDataAdapter da = new SqlDataAdapter(SelectCommand);
 
   da.Fill(ds);
   Gridview1.DataSource = ds;
   Gridview1.DataBind();
}

[edit]code block added[/edit]
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 679
1 OriginalGriff 460
2 CPallini 242
3 Andy Lanng 235
4 F-ES Sitecore 160
0 OriginalGriff 8,864
1 Sergey Alexandrovich Kryukov 8,245
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606


Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100