S
sanju
Hi ,
I am displaying 5 photos of a user(getting image path from database) and
binding them to hyperlink control and adding that Hyperlink control to
Datalist container in code behind file.
Now I want to change last 2 photos of user with another image while loading
the page.
My situation is "I want to hide/mask photos of user depending on the
permission level of who accessing the website.if one is paid member i want
to display all or for free members i need to display few.
................ code ......
try
{
DataList1.ItemTemplate = new DatalistHyperLinkColumn();
DataList1.DataSource =ds1;
DataList1.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
finally
{
PhotosConnection.Close();
}
}
public class DatalistHyperLinkColumn : ITemplate
{
public DatalistHyperLinkColumn()
{
//Add constructor stuff here
}
public void InstantiateIn(Control container)
{
HyperLink hpl = new HyperLink();
hpl.DataBinding += new EventHandler(this.BindLabelColumn);
container.Controls.Add(hpl);
}
public void BindLabelColumn(object sender, EventArgs e)
{
HyperLink hpl1 = (HyperLink)sender;
DataListItem container = (DataListItem)hpl1.NamingContainer;
String strVals =
Convert.ToString(DataBinder.Eval(((DataListItem)container).DataItem,
"ThumbImagePath"));
String lImagePath =
Convert.ToString(DataBinder.Eval(((DataListItem)container).DataItem,
"LargeImagePath"));
int pCount1 =
Convert.ToInt32(DataBinder.Eval(((DataListItem)container).DataItem,
"photocount1"));
hpl1.ImageUrl = "Photos/"+strVals;
hpl1.NavigateUrl = "Photos/web/" + lImagePath;
}
......................................
plz can one help me put..
Thanks in advance
Sanju
I am displaying 5 photos of a user(getting image path from database) and
binding them to hyperlink control and adding that Hyperlink control to
Datalist container in code behind file.
Now I want to change last 2 photos of user with another image while loading
the page.
My situation is "I want to hide/mask photos of user depending on the
permission level of who accessing the website.if one is paid member i want
to display all or for free members i need to display few.
................ code ......
try
{
DataList1.ItemTemplate = new DatalistHyperLinkColumn();
DataList1.DataSource =ds1;
DataList1.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
finally
{
PhotosConnection.Close();
}
}
public class DatalistHyperLinkColumn : ITemplate
{
public DatalistHyperLinkColumn()
{
//Add constructor stuff here
}
public void InstantiateIn(Control container)
{
HyperLink hpl = new HyperLink();
hpl.DataBinding += new EventHandler(this.BindLabelColumn);
container.Controls.Add(hpl);
}
public void BindLabelColumn(object sender, EventArgs e)
{
HyperLink hpl1 = (HyperLink)sender;
DataListItem container = (DataListItem)hpl1.NamingContainer;
String strVals =
Convert.ToString(DataBinder.Eval(((DataListItem)container).DataItem,
"ThumbImagePath"));
String lImagePath =
Convert.ToString(DataBinder.Eval(((DataListItem)container).DataItem,
"LargeImagePath"));
int pCount1 =
Convert.ToInt32(DataBinder.Eval(((DataListItem)container).DataItem,
"photocount1"));
hpl1.ImageUrl = "Photos/"+strVals;
hpl1.NavigateUrl = "Photos/web/" + lImagePath;
}
......................................
plz can one help me put..
Thanks in advance
Sanju