Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
[no name] 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 18-Nov-12 5:00am    
no u r wrong...for everyone whoever login on site.

1 solution

I have solved it.:)
on page load using this code.
C#
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]
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900