Hidding a Item (Column) of a DataList

F

Fabiano

Please,

i need to hide a Item(Collumn) of a DataList that is inside of another
DataList based on some data that i my database returns. For a sample i
created the code above, but it doesn't work. I tryed the visible property,
everything.

Tks in adv.

Fabiano


DataList dtlAuxiliar = new DataList();
for (int i=0; i < dtlVisaoMOL.Items.Count; i++)
{
dtlAuxiliar = ((DataList)
dtlVisaoMOL.Items.FindControl("dtlTerminal"));
int Total = dtlAuxiliar.Items.Count;
for (int x=0; x < Total; x++)
{
dtlAuxiliar.Items[x].Attributes.Add("style", "DISPLAY: none;");
Total--;
}
}
 
Y

Yunus Emre ALPÖZEN [MCSD.NET]

First of all,

int Total = dtlAuxiliar.Items.Count;
for (int x=0; x < Total; x++)
{
dtlAuxiliar.Items[x].Attributes.Add("style", "DISPLAY: none;");
Total--;
}

This code iterates for the half of the dtlAuxiliar.Items.Count.
It is C# behaviour. This behaviour differs on programming languages. And C#
every time checks condition like C++. It makes for a bit slower. It is
another subject to discuss. I wanna to concentrate on your problem.

U modify datalist items visibilty but next round trip all this properties
gone. My advice u to modify datasource of your datalist... Try to filter
datalist' datasource..
--
HTH

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET
 
R

Robert Smith

Please,

i need to hide a Item(Collumn) of a DataList that is inside of another
DataList based on some data that i my database returns. For a sample i
created the code above, but it doesn't work. I tryed the visible property,
everything.

Tks in adv.

Fabiano




Fabiano said:
Please,

i need to hide a Item(Collumn) of a DataList that is inside of another
DataList based on some data that i my database returns. For a sample i
created the code above, but it doesn't work. I tryed the visible property,
everything.

Tks in adv.

Fabiano


DataList dtlAuxiliar = new DataList();
for (int i=0; i < dtlVisaoMOL.Items.Count; i++)
{
dtlAuxiliar = ((DataList)
dtlVisaoMOL.Items.FindControl("dtlTerminal"));
int Total = dtlAuxiliar.Items.Count;
for (int x=0; x < Total; x++)
{
dtlAuxiliar.Items[x].Attributes.Add("style", "DISPLAY: none;");
Total--;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top