I am using repeater to bind all table data.
And My table fields are Name,Option1,Option2… Option12. All total 13 columns.
values for Option columns are dynamic. some time it contains two values for Option1 and 2 and some times figure can be change between 1 to 12.
Now i want to show only those option columns that contain some value.
Like this:-
Name
Option1
Option2
Option8
Name
Option10
Option12
Option4
Otion3
Name
Option5
Option7
Name
Option3
Option2
Option5
Option12
Option4
Means options are not fixed. how can i manage this with Repeater control.
SO it can show value like this. Please suggest me the correct way to solve this.
Thanks in Advance.
First Edit
<%# !Equals(DataBinder.Eval(Container.DataItem, "Option1")%>
....
<%# !Equals(DataBinder.Eval(Container.DataItem, "Option12")%>
Suppose i have this 12 Options like this.
Now if my data source contains values only Option 1 to 5 then i need that rest of 6 to 12 options will not show on repeater.
Try this it’s helpful for you,
using System.Text;
using System.Xml;
using System.Xml.Schema;
public class Customer
{
private int id;
public int ID
{
get { return this.id; }
set { this.id = value; }
}
}
public class Order
{
private int orderID;
public int OrderID
{
get { return this.orderID; }
set { this.orderID = value; }
}
private string orderName;
public string OrderName
{
get { return this.orderName; }
set { this.orderName = value; }
}
private decimal orderCost;
public decimal OrderCost
{
get { return this.orderCost; }
set { this.orderCost = value; }
}
}
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List orders1 = new List();
Order order1 = new Order();
order1.OrderID = 1;
order1.OrderName = “Pepsi”;
order1.OrderCost = 12.5M;
orders1.Add(order1);
}
Go through following link
http://forums.asp.net/t/1118175.aspx/1