What is wrong with this line?

M

Miguel Dias Moura

Hello,

i want to display the image "icon-yes.gif" if a certain condition is true or the image "icon-no.gif" if it's false.

I have this line:
<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif" "icon-no.gif" %>'></td>


I get this error
Compiler Error Message: BC30455: Argument not specified for parameter 'FalsePart' of 'Public Function IIf(Expression As Boolean, TruePart As Object, FalsePart As Object) As Object'.

Then i tryied to change the line to:
<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif", "icon-no.gif" %>'></td>

I keep having the same error.

Can somebody help me? I am using ASP.NET / VB.

Thank You,
Miguel
 
N

NM

Hi,

"Miguel Dias Moura" <[email protected]> a écrit dans le message de Hello,

i want to display the image "icon-yes.gif" if a certain condition is true or the image "icon-no.gif" if it's false.

I have this line:
<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif" "icon-no.gif" %>'></td>

You need to add coma between "icon-yes.gif" and "icon-no.gif"

<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif", "icon-no.gif") %>'></td>

Regards
 
M

Miguel Dias Moura

Hi NM,

that's what i allready did. I wrote that in my first post. When i do that i get this message:
Compiler Error Message: BC30198: ')' expected.

Any idea?

Thanks,
Miguel
Hi,

"Miguel Dias Moura" <[email protected]> a écrit dans le message de Hello,

i want to display the image "icon-yes.gif" if a certain condition is true or the image "icon-no.gif" if it's false.

I have this line:
<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif" "icon-no.gif" %>'></td>

You need to add coma between "icon-yes.gif" and "icon-no.gif"

<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif", "icon-no.gif") %>'></td>

Regards
 
M

Marina

You need to close the parenthesis, because you have an opening paren for your IIF, but not a closing one.
Hello,

i want to display the image "icon-yes.gif" if a certain condition is true or the image "icon-no.gif" if it's false.

I have this line:
<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif" "icon-no.gif" %>'></td>


I get this error
Compiler Error Message: BC30455: Argument not specified for parameter 'FalsePart' of 'Public Function IIf(Expression As Boolean, TruePart As Object, FalsePart As Object) As Object'.

Then i tryied to change the line to:
<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif", "icon-no.gif" %>'></td>

I keep having the same error.

Can somebody help me? I am using ASP.NET / VB.

Thank You,
Miguel
 
C

Cor Ligthert

Hi Miguel,

I think that the error is that you need a , and a )

<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif" , "icon-no.gif") %>'></td>

Why do you not write nice ASPX instead of a kind of coding ASP style in ASPNET, you have got some samples from me, using that it is easier to see where are the errrors?

Cor
 
H

Herfried K. Wagner [MVP]

* "Miguel Dias Moura said:
<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif"

There is a ', ' missing here.
"icon-no.gif"

.... and a ')' here.
 
M

Miguel Dias Moura

What do you mean? How would you create this?
I am what would be the best way to do this?

Thanks,
Miguel
Hi Miguel,

I think that the error is that you need a , and a )

<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif" , "icon-no.gif") %>'></td>

Why do you not write nice ASPX instead of a kind of coding ASP style in ASPNET, you have got some samples from me, using that it is easier to see where are the errrors?

Cor
 
M

Miguel Dias Moura

Ah what a stupid mistake...i didn't find it so i thought i was doing some
very wrong. It was such a simple thing.

Thank You,
Miguel

IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif"
 
C

Cor Ligthert

Hi Miguel,

I corrected the sentence in your code and you did not even see it. That is because in ASP the code is mixed up between the HTML. One of the benefits of ASPX is that that is not needed anymore.

I have sended the sample with the panels to you, when I take only a little part from it by instance a form with only a button on a form and a textbox which when ther is typed something shows the msdn page from microsoft you get this. I find this better to read.

Cor

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="VB" runat="server">
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs)
If TextBox1.Text = "" Then
Label1.Text = "You should type something"
Else
Response.Redirect("http:\\Msdn.microsoft.com")
End If
End Sub
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Button"></asp:Button><br>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox><br>
<asp:Label id="Label1" runat="server" Width="144px"></asp:Label>
</form>
</body>
</HTML>
///
 
B

Brian Lowe

Hello,


Then i tryied to change the line to:
<td><img runat="server" src='<%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif", "icon-no.gif" %>'></td>

I keep having the same error.

Can somebody help me? I am using ASP.NET / VB.


You still haven't closed the parentheses for the IIF()

Try <%# "..image/" & IIF(dataSetPerson.FieldValue("Author", Container) = "Yes", "icon-yes.gif", "icon-no.gif" ) %>

Brian Lowe
---------@
 
M

Miguel Dias Moura

Hi,

i know what you mean but until now i have been working mostly in Actionscript and Flash.

I am not used to ASP so much. I started to use ASP.NET but sometimes in foruns i get answers that do exactly that: a misture between ASP and ASP.NET and i don't even notice.

The example you sent me is exactly what i use to place a button in my pages and redirect it somewhere...see? I am getting there :)

By the way, can you sugest me really good books where i can learn ASP.NET?

If possible tell me some titles, from the simple stuff to the really hard stuff.
When i have a book in front of me i am a fast learner. I am used to it.

Thanks,
Miguel

Hi Miguel,

I corrected the sentence in your code and you did not even see it. That is because in ASP the code is mixed up between the HTML. One of the benefits of ASPX is that that is not needed anymore.

I have sended the sample with the panels to you, when I take only a little part from it by instance a form with only a button on a form and a textbox which when ther is typed something shows the msdn page from microsoft you get this. I find this better to read.

Cor

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="VB" runat="server">
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs)
If TextBox1.Text = "" Then
Label1.Text = "You should type something"
Else
Response.Redirect("http:\\Msdn.microsoft.com")
End If
End Sub
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Button"></asp:Button><br>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox><br>
<asp:Label id="Label1" runat="server" Width="144px"></asp:Label>
</form>
</body>
</HTML>
///
 
M

Miguel Dias Moura

Ah about that last part you sent me of the panels...it didn't work out. Have no idea why. I tried to find what was wrong but no success.

Then i created a different code based a little bit on the ideas you gave me. It's working but i think it could be better.

What do you think?

<script language="VB" runat="server">

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

If Not IsPostBack Then
panelDados1.visible = True
End If

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)

panelDados1.Visible = True
panelDados2.Visible = False
panelDados3.Visible = False
panelDados4.Visible = False
panelDados5.Visible = False

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)

panelDados1.Visible = False
panelDados2.Visible = True
panelDados3.Visible = False
panelDados4.Visible = False
panelDados5.Visible = False

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)

panelDados1.Visible = False
panelDados2.Visible = False
panelDados3.Visible = True
panelDados4.Visible = False
panelDados5.Visible = False

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)

panelDados1.Visible = False
panelDados2.Visible = False
panelDados3.Visible = False
panelDados4.Visible = True
panelDados5.Visible = False

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)

panelDados1.Visible = False
panelDados2.Visible = False
panelDados3.Visible = False
panelDados4.Visible = False
panelDados5.Visible = True

End Sub

</script>

Thanks,
Miguel

Hi Miguel,

I corrected the sentence in your code and you did not even see it. That is because in ASP the code is mixed up between the HTML. One of the benefits of ASPX is that that is not needed anymore.

I have sended the sample with the panels to you, when I take only a little part from it by instance a form with only a button on a form and a textbox which when ther is typed something shows the msdn page from microsoft you get this. I find this better to read.

Cor

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="VB" runat="server">
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs)
If TextBox1.Text = "" Then
Label1.Text = "You should type something"
Else
Response.Redirect("http:\\Msdn.microsoft.com")
End If
End Sub
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Button"></asp:Button><br>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox><br>
<asp:Label id="Label1" runat="server" Width="144px"></asp:Label>
</form>
</body>
</HTML>
///
 
C

Cor Ligthert

I have given the sollution to your problem in the original thread, answer it there because now I get the idea you did not see it.

You do not need that much code as you are using now.

Although I have used a for beginners often difficult routine to set all the panels to invisible (I think that there is the problem when you look at the code) and than in the button click every time set the last visible to invisible and the next to visible.

And maybe did you not see that routine to make the panels invisible.

Answer it in that thread please than it is better to explain.


Cor
 
G

Guest

How much Dew (trademark) has gone into this already? I am only just installing Visual Basic Studio.NET on the HP, and I can not wait to start creating. Good luck, Miguel. I would give a kernel to have an instant answer for you.

Rev. Chuck ;)
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top