Click here to Skip to main content
15,910,773 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

I am using a Repeater which contains 5 columns which are Table1,Table1Count,Table2,Table2Count,DifferenceInCount.DifferenceInCount is the Linkbutton column where it will give the difference between Count1 and Count2.

What i need to do is if the count Difference is comes as 0(zero),the i need to make the corresponding linkbutton as label field.Can anyone please help me in doing this...
Posted

1 solution

Try this one, It may help you :-

Where you have linkbutton field you just keep a label field also. Intially those two controls visibility is false and there text is similar as uyou have. At the time binding row by row decide whether you will make visible linkbutton or label. That logic will help you and that is possible by ItemDataBound event of Repeater control same as RowDataBound event of GridView control. Sample code is given below :-

protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == DataControlRowType.DataRow)
{
LinkButton lbt = (LinkButton) e.Item.FindControl("LinkButton1");
Label lbl = (Label)e.Item.FindControl("Label1");

if (lbt.Text == "0")
{
lbt.Visible = false;
lbl.Visible = true;
}
else
{
lbt.Visible = true;
lbl.Visible = false;
}

}
}
 
Share this answer
 

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