// This event is raised for the header, the footer, separators,
and items.
protected
void R1_ItemDataBound(Object
Sender, RepeaterItemEventArgs e)
{
//
Execute the following logic for Items and Alternating Items.
if
(e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
if
(((Evaluation)e.Item.DataItem).Rating == "Good")
{
((Label)e.Item.FindControl("RatingLabel")).Text = "<b>***Good***</b>";
}
}
}
(or)
protected
void rptMyReteater_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
if
(e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
Button
b = e.Item.FindControl("myButton")
as Button;
DataRowView
drv = e.Item.DataItem as DataRowView;
b.CommandArgument = drv.Row["ID_COLUMN_NAME"].ToString();
}
}
(OR)
protected void
rpt_rooms_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
try
{
if
(e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
Label
roomid = (Label)e.Item.FindControl("Label1");
Label
room_type_id = (Label)e.Item.FindControl("Label2");
GridView
gvreply = e.Item.FindControl("gvreply")
as GridView;
gvreply.DataSource = dt;
gvreply.DataBind();
DataList
dl_gallery = e.Item.FindControl("dl_gallery")
as DataList;
dl_gallery.DataSource =
dt3;
dl_gallery.DataBind();
DropDownList
ddl_extra_beds = e.Item.FindControl("ddl_extra_bed")
as DropDownList;
}
}
catch
(Exception ex)
{
lblerror.Visible = true;
lblerror.ForeColor =
System.Drawing.Color.Red;
lblerror.Text = ex.Message;
}
}
No comments:
Post a Comment