Showing posts with label clause. Show all posts
Showing posts with label clause. Show all posts

Tuesday, March 13, 2012

The link button is not showingcorrect

I have a datalist. This is the code.
I have 2linkbuttons and it depends of a field to show one or the other.
The IF clause is OK, but its showing me the links in BLACK not in blue! and
they are like plain text not links.
asp:DataList id="dlsolicitud" runat="server" Width="800px"
GridLines="Both" CellPadding="4" BorderColor="#CC9966"
BackColor="White" BorderStyle="None" BorderWidth="1px">
<SelectedItemStyle Font-Bold="True" ForeColor="#663399"
BackColor="#FFCC66"></SelectedItemStyle>
<HeaderTemplate>
<TABLE id="Table2" runat="server" borderColor="#000000"
cellSpacing="1" cellPadding="1"
width="800" border="1" runat="server">
<TR>
<TD width="30">Id</TD>
<TD width="200">Nombre</TD>
<TD width="50">Prioridad</TD>
<TD width="500">Diagnostico</TD>
<TD width="50">Estadl</TD>
<TD width="20"></TD>
</TR>
</TABLE>
</HeaderTemplate>
<ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
<ItemTemplate>
<TABLE id="Table2" borderColor="#000000" cellSpacing="1"
cellPadding="1" width="800" border="1"
runat="server">
<TR>
<TD width="30"><%# DataBinder.Eval(Container,
"DataItem.idserviciomantenimiento") %></TD>
<TD width="200"><%# DataBinder.Eval(Container,
"DataItem.nombre") %></TD>
<TD width="50"><%# DataBinder.Eval(Container,
"DataItem.prioridad") %></TD>
<TD width="500"><%# DataBinder.Eval(Container,
"DataItem.diagnostico") %></TD>
<TD width="50"><%# DataBinder.Eval(Container, "DataItem.estado")
%></TD>
<TD width="20">
<asp:linkbutton Runat="server" ID="ejecutar" visible='<%#
iif(DataBinder.Eval(Container, "DataItem.Estado")="ENVIADO",1,0) %>'
CommandName="Ejecutar">Ejecutar</asp:linkbutton>
<asp:linkbutton Runat="server" ID="finalizar" visible='<%#
iif(DataBinder.Eval(Container, "DataItem.Estado")="EN EJECUCION",1,0) %>'
CommandName="Finalizar">Finalizar</asp:linkbutton>
</TD>
</TR>
</TABLE>
</ItemTemplate>
<FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
<HeaderStyle Font-Bold="True" ForeColor="#FFFFCC"
BackColor="#990000"></HeaderStyle>
</asp:DataList>
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 1.
MIEMBRO ACTIVO DE ALIANZADEVfor an anchor (what a link button renders as), you need to set the following
styles:
a :visted
a :link
a :active
a :hover
to control the display
-- bruce (sqlwork.com)
"Luis Esteban Valencia" <luisvalen@.haceb.com> wrote in message
news:uF2ZcbRkEHA.556@.tk2msftngp13.phx.gbl...
> I have a datalist. This is the code.
> I have 2linkbuttons and it depends of a field to show one or the other.
> The IF clause is OK, but its showing me the links in BLACK not in blue!
and
> they are like plain text not links.
> asp:DataList id="dlsolicitud" runat="server" Width="800px"
> GridLines="Both" CellPadding="4" BorderColor="#CC9966"
> BackColor="White" BorderStyle="None" BorderWidth="1px">
> <SelectedItemStyle Font-Bold="True" ForeColor="#663399"
> BackColor="#FFCC66"></SelectedItemStyle>
> <HeaderTemplate>
> <TABLE id="Table2" runat="server" borderColor="#000000"
> cellSpacing="1" cellPadding="1"
> width="800" border="1" runat="server">
> <TR>
> <TD width="30">Id</TD>
> <TD width="200">Nombre</TD>
> <TD width="50">Prioridad</TD>
> <TD width="500">Diagnostico</TD>
> <TD width="50">Estadl</TD>
> <TD width="20"></TD>
> </TR>
> </TABLE>
> </HeaderTemplate>
> <ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
> <ItemTemplate>
> <TABLE id="Table2" borderColor="#000000" cellSpacing="1"
> cellPadding="1" width="800" border="1"
> runat="server">
> <TR>
> <TD width="30"><%# DataBinder.Eval(Container,
> "DataItem.idserviciomantenimiento") %></TD>
> <TD width="200"><%# DataBinder.Eval(Container,
> "DataItem.nombre") %></TD>
> <TD width="50"><%# DataBinder.Eval(Container,
> "DataItem.prioridad") %></TD>
> <TD width="500"><%# DataBinder.Eval(Container,
> "DataItem.diagnostico") %></TD>
> <TD width="50"><%# DataBinder.Eval(Container,
"DataItem.estado")
> %></TD>
> <TD width="20">
> <asp:linkbutton Runat="server" ID="ejecutar" visible='<%#
> iif(DataBinder.Eval(Container, "DataItem.Estado")="ENVIADO",1,0) %>'
> CommandName="Ejecutar">Ejecutar</asp:linkbutton>
> <asp:linkbutton Runat="server" ID="finalizar" visible='<%#
> iif(DataBinder.Eval(Container, "DataItem.Estado")="EN EJECUCION",1,0) %>'
> CommandName="Finalizar">Finalizar</asp:linkbutton>
> </TD>
> </TR>
> </TABLE>
> </ItemTemplate>
> <FooterStyle ForeColor="#330099"
BackColor="#FFFFCC"></FooterStyle>
> <HeaderStyle Font-Bold="True" ForeColor="#FFFFCC"
> BackColor="#990000"></HeaderStyle>
> </asp:DataList>
>
> --
> LUIS ESTEBAN VALENCIA
> MICROSOFT DCE 1.
> MIEMBRO ACTIVO DE ALIANZADEV
>

The link button is not showingcorrect

I have a datalist. This is the code.
I have 2linkbuttons and it depends of a field to show one or the other.

The IF clause is OK, but its showing me the links in BLACK not in blue! and
they are like plain text not links.

asp:DataList id="dlsolicitud" runat="server" Width="800px"
GridLines="Both" CellPadding="4" BorderColor="#CC9966"
BackColor="White" BorderStyle="None" BorderWidth="1px">
<SelectedItemStyle Font-Bold="True" ForeColor="#663399"
BackColor="#FFCC66"></SelectedItemStyle>
<HeaderTemplate>
<TABLE id="Table2" runat="server" borderColor="#000000"
cellSpacing="1" cellPadding="1"
width="800" border="1" runat="server">
<TR>
<TD width="30">Id</TD>
<TD width="200">Nombre</TD>
<TD width="50">Prioridad</TD>
<TD width="500">Diagnostico</TD>
<TD width="50">Estadl</TD>
<TD width="20"></TD>
</TR>
</TABLE>
</HeaderTemplate>
<ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
<ItemTemplate>
<TABLE id="Table2" borderColor="#000000" cellSpacing="1"
cellPadding="1" width="800" border="1"
runat="server">
<TR>
<TD width="30"><%# DataBinder.Eval(Container,
"DataItem.idserviciomantenimiento") %></TD>
<TD width="200"><%# DataBinder.Eval(Container,
"DataItem.nombre") %></TD>
<TD width="50"><%# DataBinder.Eval(Container,
"DataItem.prioridad") %></TD>
<TD width="500"><%# DataBinder.Eval(Container,
"DataItem.diagnostico") %></TD>
<TD width="50"><%# DataBinder.Eval(Container, "DataItem.estado")
%></TD>
<TD width="20">
<asp:linkbutton Runat="server" ID="ejecutar" visible='<%#
iif(DataBinder.Eval(Container, "DataItem.Estado")="ENVIADO",1,0) %>'
CommandName="Ejecutar">Ejecutar</asp:linkbutton>
<asp:linkbutton Runat="server" ID="finalizar" visible='<%#
iif(DataBinder.Eval(Container, "DataItem.Estado")="EN EJECUCION",1,0) %>'
CommandName="Finalizar">Finalizar</asp:linkbutton>
</TD>
</TR>
</TABLE>
</ItemTemplate>
<FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
<HeaderStyle Font-Bold="True" ForeColor="#FFFFCC"
BackColor="#990000"></HeaderStyle>
</asp:DataList
--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 1.
MIEMBRO ACTIVO DE ALIANZADEVfor an anchor (what a link button renders as), you need to set the following
styles:

a :visted
a :link
a :active
a :hover

to control the display

-- bruce (sqlwork.com)

"Luis Esteban Valencia" <luisvalen@.haceb.com> wrote in message
news:uF2ZcbRkEHA.556@.tk2msftngp13.phx.gbl...
> I have a datalist. This is the code.
> I have 2linkbuttons and it depends of a field to show one or the other.
> The IF clause is OK, but its showing me the links in BLACK not in blue!
and
> they are like plain text not links.
> asp:DataList id="dlsolicitud" runat="server" Width="800px"
> GridLines="Both" CellPadding="4" BorderColor="#CC9966"
> BackColor="White" BorderStyle="None" BorderWidth="1px">
> <SelectedItemStyle Font-Bold="True" ForeColor="#663399"
> BackColor="#FFCC66"></SelectedItemStyle>
> <HeaderTemplate>
> <TABLE id="Table2" runat="server" borderColor="#000000"
> cellSpacing="1" cellPadding="1"
> width="800" border="1" runat="server">
> <TR>
> <TD width="30">Id</TD>
> <TD width="200">Nombre</TD>
> <TD width="50">Prioridad</TD>
> <TD width="500">Diagnostico</TD>
> <TD width="50">Estadl</TD>
> <TD width="20"></TD>
> </TR>
> </TABLE>
> </HeaderTemplate>
> <ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
> <ItemTemplate>
> <TABLE id="Table2" borderColor="#000000" cellSpacing="1"
> cellPadding="1" width="800" border="1"
> runat="server">
> <TR>
> <TD width="30"><%# DataBinder.Eval(Container,
> "DataItem.idserviciomantenimiento") %></TD>
> <TD width="200"><%# DataBinder.Eval(Container,
> "DataItem.nombre") %></TD>
> <TD width="50"><%# DataBinder.Eval(Container,
> "DataItem.prioridad") %></TD>
> <TD width="500"><%# DataBinder.Eval(Container,
> "DataItem.diagnostico") %></TD>
> <TD width="50"><%# DataBinder.Eval(Container,
"DataItem.estado")
> %></TD>
> <TD width="20">
> <asp:linkbutton Runat="server" ID="ejecutar" visible='<%#
> iif(DataBinder.Eval(Container, "DataItem.Estado")="ENVIADO",1,0) %>'
> CommandName="Ejecutar">Ejecutar</asp:linkbutton>
> <asp:linkbutton Runat="server" ID="finalizar" visible='<%#
> iif(DataBinder.Eval(Container, "DataItem.Estado")="EN EJECUCION",1,0) %>'
> CommandName="Finalizar">Finalizar</asp:linkbutton>
> </TD>
> </TR>
> </TABLE>
> </ItemTemplate>
> <FooterStyle ForeColor="#330099"
BackColor="#FFFFCC"></FooterStyle>
> <HeaderStyle Font-Bold="True" ForeColor="#FFFFCC"
> BackColor="#990000"></HeaderStyle>
> </asp:DataList>
>
> --
> LUIS ESTEBAN VALENCIA
> MICROSOFT DCE 1.
> MIEMBRO ACTIVO DE ALIANZADEV

The LINQ "where" clause

Hi guys,

I'm trying to write a LINQ query in which the where clause can accept 6 parameters. The problem is that all of them are optional parameters and need to be validated as not Null or Empty in order to be used. Normally when I used the SqlCommand I would build a string for the query via conditional statements, like:

if (!String.IsNullOrEmpty(TextBox1.Text)) { SqlString +="..." }

How do I do the equivalent to that in LINQ?

Thanks in advance!

not sure if i understand what you mean. do you mean validate a statement as a parameter? In that case you can write like this with the ? syntax:

object o;

o = (cond1 = cond2 ? truevalue : falsevalue);

MyFunction( String.IsNullOrEmpty(TextBox1.Text) ? truevalue : falsevalue)


Well, this is how I did it the non-LINQ way:

string SqlString =string.Empty;if (!String.IsNullOrEmpty(TextBox1.Text)) { SqlString +="...";}if (!String.IsNullOrEmpty(TextBox2.Text)) { SqlString +="...";}SqlCommand MyCommand =new SqlCommand(SqlString, MyConnection);

In the code above I created the SqlString variable. After that I would check if the Text property is Null or Empty for the TextBox1 & TextBox2 andonly append to the SqlString if they are not. Then I run the newly built Sql query. I need to do the equivalent in LINQ and I just don't know how.