Last post Apr 10, 2012 12:54 AM by basheerkal
Apr 09, 2012 04:47 PM|richkyrs|LINK
i have managed to upload picture but saves in image folder and database
but how can i get that picture to show on profile page when user wants a picture on his or her profile page
Apr 09, 2012 05:49 PM|richkyrs|LINK
i have it saved succesully in database and image folder how do i get it to show on the user profile page
i have app code folder
Apr 09, 2012 06:27 PM|Primillo|LINK
SELECT ImageName, ImagePath FROM YourProfileTable WHERE UserID=@UserID
You can use a repeater to display all info: Home url, Full name, Image, etc.
Apr 09, 2012 06:42 PM|richkyrs|LINK
this is what i have in my userprofile how would you do that?
SqlConnection sqlCon = new SqlConnection(ConnectionString);
SqlCommand sqlCom = new SqlCommand("SELECT Count(Username) FROM tblUserProfile WHERE
sqlCom.CommandType = System.Data.CommandType.Text;
Apr 09, 2012 06:47 PM|Primillo|LINK
You know how to use a repeater and a SqlDataSource control?
Apr 09, 2012 06:48 PM|richkyrs|LINK
sorry should i say thats displayed in my App_code/LoginHELPER.CS
Apr 09, 2012 06:50 PM|richkyrs|LINK
not got a clue how to use reapeater etc i got all this created for me apart from image thing i did myself
unless you fancy copynpasteing my work or something
Apr 09, 2012 06:55 PM|richkyrs|LINK
basically i made a login and stuff like that but the coder guy created alot of folders which i dont know half of them
looks akward but i like his work what he done for me but images is a problem that im trying to add
Apr 10, 2012 12:54 AM|basheerkal|LINK
Try a tutorial like this.
Assumed that in yourtable Username, Name and Path of the image are stored in "UsernameField".
"NameField" and "ImagePathField" repectively.
Put a GridView in your aspx page within your form as shown below.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" >
<asp:Label ID="lbl1" runat="server" Text='<%# Bind("Namefiled") %>'></asp:Label>
<asp:Image ID="Image1" runat="server" ImageUrl= '<%# Bind("ImagePathField") %>'/>
In your code behind add this code
public void getPhoto()
con = new SqlConnection(YourConnectionString);
string CurrentUserName = User.Identity.Name
string qry = "select * from YourTable Where usernamefield = '" + CurrentUserName + "'" ;
SqlCommand cmd = new SqlCommand(qry, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
if (dt.Rows.Count > 0)
GridView1.DataSource = dt;
protected void Page_Load(object sender, EventArgs e)
Run your page ..
Hope this will give you a basic idea about showing images in web pages based on logged in user