Kristen Jones
asked on
c# syntax on a ASP.Net page
I have a datagrid that I and using a nested View template using Telerik But what I want to do is just do a simple If then based on the data in the GIS field.
Cannot implicitly convert object to Bool. and then another error on the %> closing saying expected class.
I'm new to C# so just heed a little help here I think
Here is the WHOLE page for reference
Cannot implicitly convert object to Bool. and then another error on the %> closing saying expected class.
I'm new to C# so just heed a little help here I think
<%# if (DataBinder.Eval(Container.DataItem,"GIS")) = 'yes')
{
%>
THIS IS A TEST GIS IS TURNED ON then do something
<%
}
%>
Here is the WHOLE page for reference
<%@ Page Title="" Language="C#" MasterPageFile="~/MASTER-MAIN.Master" AutoEventWireup="true" CodeBehind="MCDPermitView.aspx.cs" Inherits="MCD_INTRANET.MCDPermitView" %>
<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=6.2.12.1017, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.auto-style9
{
font-size: large;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<span class="auto-style9"><strong>MCD Permit Search and Report Tool</strong></span><br />
<br />
To use this tool, use the filter and sort options under the column headers below. To sort a column just click on the column header(s). Click on the small triangle to expand the report details.
<br />
If you want to view, print or download the report, click the "Update report query" button and then scroll down to see the report.<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Update report query" PostBackUrl="~/Permits/MCDPermitView.aspx" />
<asp:Button ID="Button2" runat="server" Text="Load Report" PostBackUrl="~/Permits/MCDPermitView.aspx" OnClick="Button2_Click" />
<br />
<asp:Label ID="MESSAGElbl" runat="server" Text="DEFAULT TEXT IS HERE"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PermitsConnectionString %>" SelectCommand="SELECT vPERMITS.MCDNUM, vPERMITS.ISSUEDTO, vPERMITS.DATEISSUED, vPERMITS.LOCATION + ' --- ' + vPERMITS.FEATURE AS LOCATION, vPERMITS.PURPOSE,vPERMITS.GIS,
vPERMITS.EXPIREDATE , (CAST(THETYPE AS varchar(12)) + ' - ' + DESCRIPTION) as PERMIT, vPERMITS.AUTOID, vPERMITS.STATUS
FROM PERMITTYPES RIGHT OUTER JOIN
vPERMITS ON PERMITTYPES.PERMITCODE = vPERMITS.THETYPE ORDER BY MCDNUM"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:PermitsConnectionString %>" SelectCommand=" SELECT *
FROM vPERMITS
where AUTOID =@AUTOID">
<SelectParameters>
<asp:Parameter DefaultValue="1" Name="AUTOID" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:PermitsConnectionString %>" SelectCommand="SELECT distinct [STATUS] FROM [vPERMITS] order by STATUS"></asp:SqlDataSource>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="None" Height="700px" PageSize="100" ShowFooter="True" ShowGroupPanel="True" AutoGenerateColumns="False" Style="margin-top: 0px; margin-right: 50px;" OnNeedDataSource="RadGrid1_NeedDataSource" EnableLinqExpressions='False' OnItemCommand="RadGrid1_ItemCommand1">
<GroupingSettings CaseSensitive="false" />
<ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True">
<Selecting AllowRowSelect="True" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
<Resizing AllowColumnResize="True" AllowResizeToFit="True" AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" />
<Animation AllowColumnReorderAnimation="True" AllowColumnRevertAnimation="True" />
</ClientSettings>
<MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="AUTOID" AllowMultiColumnSorting="True" GroupLoadMode="Server">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridHyperLinkColumn AllowFiltering="False" AllowSorting="False" DataNavigateUrlFields="AUTOID" DataNavigateUrlFormatString="MCDPermitView.aspx?ID={0}" DataTextField="AUTOID" EditFormHeaderTextFormat="test {0}:" FilterControlAltText="Filter AUTOIDCOLUMN column" HeaderText=" " ImageUrl="/images/Info-Small.png" UniqueName="AUTOIDCOLUMN">
<HeaderStyle Width="30px" />
</telerik:GridHyperLinkColumn>
<telerik:GridBoundColumn DataField="MCDNUM" DataType="System.Double" FilterControlAltText="Filter MCDNUM column" HeaderText="MCDNUM" SortExpression="MCDNUM" UniqueName="MCDNUM" FilterControlWidth="30px">
<HeaderStyle Width="75px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ISSUEDTO" FilterControlAltText="Filter ISSUEDTO column" HeaderText="ISSUEDTO" SortExpression="ISSUEDTO" UniqueName="ISSUEDTO">
<HeaderStyle Width="150px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DATEISSUED" DataType="System.DateTime" FilterControlAltText="Filter DATEISSUED column" HeaderText="DATEISSUED"
SortExpression="DATEISSUED" UniqueName="DATEISSUED" DataFormatString="{0:d}" HeaderStyle-Width="350px">
<FilterTemplate>
From:
<telerik:RadDatePicker ID="FromOrderDatePicker" runat="server" Width="100px" ClientEvents-OnDateSelected="FromDateSelectedDateIssued"
MinDate="01-01-1918" MaxDate="12-31-2020" FocusedDate="01-01-1970" DbSelectedDate='<%# startDateDateIssue %>' />
<br />
To:
<telerik:RadDatePicker ID="ToOrderDatePicker" runat="server" Width="100px" ClientEvents-OnDateSelected="ToDateSelectedDateIssued"
MinDate="01-01-1918" MaxDate="12-31-2020" FocusedDate="12-31-2020" DbSelectedDate='<%# endDateDateIssue %>' />
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function FromDateSelectedDateIssued(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
var ToPicker = $find('<%# ((GridItem)Container).FindControl("ToOrderDatePicker").ClientID %>');
var fromDate = FormatSelectedDate(sender);
var toDate = FormatSelectedDate(ToPicker);
tableView.filter("DATEISSUED", fromDate + " " + toDate, "Between");
}
function ToDateSelectedDateIssued(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
var FromPicker = $find('<%# ((GridItem)Container).FindControl("FromOrderDatePicker").ClientID %>');
var fromDate = FormatSelectedDateDateIssued(FromPicker);
var toDate = FormatSelectedDateDateIssued(sender);
tableView.filter("DATEISSUED", fromDate + " " + toDate, "Between");
}
function FormatSelectedDateDateIssued(picker) {
var date = picker.get_selectedDate();
var dateInput = picker.get_dateInput();
var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat());
return formattedDate;
}
</script>
</telerik:RadScriptBlock>
</FilterTemplate>
<HeaderStyle Width="148px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LOCATION" FilterControlAltText="Filter LOCATION column" HeaderText="LOCATION" ReadOnly="True" SortExpression="LOCATION" UniqueName="LOCATION">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PURPOSE" FilterControlAltText="Filter PURPOSE column" HeaderText="PURPOSE" SortExpression="PURPOSE" UniqueName="PURPOSE">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="EXPIREDATE" DataType="System.DateTime" FilterControlAltText="Filter EXPIREDATE column" HeaderText="EXPIREDATE" SortExpression="EXPIREDATE" UniqueName="EXPIREDATE" DataFormatString="{0:d}" HeaderStyle-Width="350px">
<FilterTemplate>
From:
<telerik:RadDatePicker ID="FromOrderDatePicker2" runat="server" Width="100px" ClientEvents-OnDateSelected="FromDateSelected"
MinDate="01-01-1918" MaxDate="12-31-2020" FocusedDate="01-01-1970" DbSelectedDate='<%# startDateExpireDate %>' />
<br />
To:
<telerik:RadDatePicker ID="ToOrderDatePicker2" runat="server" Width="100px" ClientEvents-OnDateSelected="ToDateSelected"
MinDate="01-01-1918" MaxDate="12-31-2020" FocusedDate="12-31-2020" DbSelectedDate='<%# endDateExpireDate %>' />
<telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
<script type="text/javascript">
function FromDateSelected(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
var ToPicker = $find('<%# ((GridItem)Container).FindControl("ToOrderDatePicker2").ClientID %>');
var fromDate = FormatSelectedDate(sender);
var toDate = FormatSelectedDate(ToPicker);
tableView.filter("EXPIREDATE", fromDate + " " + toDate, "Between");
}
function ToDateSelected(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
var FromPicker = $find('<%# ((GridItem)Container).FindControl("FromOrderDatePicker2").ClientID %>');
var fromDate = FormatSelectedDate(FromPicker);
var toDate = FormatSelectedDate(sender);
tableView.filter("EXPIREDATE", fromDate + " " + toDate, "Between");
}
function FormatSelectedDate(picker) {
var date = picker.get_selectedDate();
var dateInput = picker.get_dateInput();
var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat());
return formattedDate;
}
</script>
</telerik:RadScriptBlock>
</FilterTemplate>
<HeaderStyle Width="148px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PERMIT" FilterControlAltText="Filter PERMIT column" HeaderText="PERMIT" SortExpression="PERMIT" UniqueName="PERMIT" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AUTOID" DataType="System.Int32" Display="False" FilterControlAltText="Filter AUTOID column" HeaderText="AUTOID" ReadOnly="True" UniqueName="AUTOID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="STATUS" DataField="STATUS" FilterControlAltText="Filter column column" HeaderText="STATUS">
<FilterTemplate>
<telerik:RadComboBox ID="RadComboBoxTitle" DataSourceID="SqlDataSource3" DataTextField="STATUS"
DataValueField="STATUS" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("STATUS").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="TitleIndexChanged">
<Items>
<telerik:RadComboBoxItem Text="All" />
</Items>
</telerik:RadComboBox>
<telerik:RadScriptBlock ID="RadScriptBlock10" runat="server">
<script type="text/javascript">
function TitleIndexChanged(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("STATUS", args.get_item().get_value(), "EqualTo");
}
</script>
</telerik:RadScriptBlock>
</FilterTemplate>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="GIS" Display="False" FilterControlAltText="Filter GIS column" HeaderText="GIS" ReadOnly="True" UniqueName="GIS" Visible="False">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
<NestedViewSettings DataSourceID="SqlDataSource2">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="AUTOID" MasterKeyField="AUTOID" />
</ParentTableRelation>
</NestedViewSettings>
<NestedViewTemplate>
<asp:Panel ID="NestedViewPanel" runat="server" CssClass="viewWrap">
<div class="contactWrap">
<fieldset style="padding: 10px;">
<legend style="padding: 5px;"><b>Details for Permit#: <%#Eval("MCDNUM") %></b></legend>
<table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>Status:
</td>
<td>
<asp:Label ID="cityLabel" Text='<%#Bind("STATUS") %>' runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>Drawing Number:
</td>
<td>
<asp:Label ID="Label2" Text='<%#Bind("DRAWINGNO") %>' runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>Scanned?:
</td>
<td>
<asp:Label ID="Label3" Text='<%#Bind("SCANNED") %>' runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>Contact:
</td>
<td>
<asp:Label ID="Label4" Text='<%#Bind("CONTACT") %>' runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>Phone:
</td>
<td>
<asp:Label ID="Label5" Text='<%#Bind("PHONE") %>' runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>Drawing Number:
</td>
<td>
<asp:Label ID="Label6" Text='<%#Bind("DRAWINGNO") %>' runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>Board:
</td>
<td>
<asp:Label ID="Label7" Text='<%#Bind("BOARD") %>' runat="server"></asp:Label>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<img src='<%# Page.ResolveUrl("/images/Info-Small.png?test=") + Eval("AUTOID") %>.jpg'
alt="Customer Image" />
<%# if (DataBinder.Eval(Container.DataItem,"GIS")) = 'yes')
{
%>
THIS IS A TEST GIS IS NOT NULL
<%
}
%>
</td>
</tr>
</tbody>
</table>
</fieldset>
</div>
</asp:Panel>
</NestedViewTemplate>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
<strong>Report based on the selection above</strong><br />
<br />
<telerik:ReportViewer ID="ReportViewer2" runat="server" Width="97%" Height="700px" Style="margin-top: 0px; margin-right: 50px;">
<typereportsource typename="MCD_INTRANET.PermitReport2, MCD INTRANET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"></typereportsource>
</telerik:ReportViewer>
</asp:Content>
Check it whether it helps out
<%# if (Convert.ToString(Eval("GI S")).Equal s("yes")) { %>
THIS IS A TEST GIS IS TURNED ON then do something
<%
}
%>
<%# if (Convert.ToString(Eval("GI
THIS IS A TEST GIS IS TURNED ON then do something
<%
}
%>
ASKER
Thanks both of you, I am out of the office and will check the solution suggestions in the morning. about 14 hours from now.
ASKER
Hi sedgwick, your code gave this compile error
Line 300: alt="Customer Image" />
Line 301:
Line 302: <%# if (DataBinder.Eval(Container .DataItem, "GIS")) == 'yes')
Line 303: {
Line 304: %>
santhimurthyd yours gave me this error
CS1518: Expected class, delegate, enum, interface, or struct
Source Error:
Line 43:
Line 44:
Line 45: <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="Tr ue" AllowPaging="True" AllowSorting="True" CellSpacing="0" DataSourceID="SqlDataSourc e1" GridLines="None" Height="700px" PageSize="100" ShowFooter="True" ShowGroupPanel="True" AutoGenerateColumns="False " Style="margin-top: 0px; margin-right: 50px;" OnNeedDataSource="RadGrid1 _NeedDataS ource" EnableLinqExpressions='Fal se' OnItemCommand="RadGrid1_It emCommand1 ">
Line 46: <GroupingSettings CaseSensitive="false" />
Line 47: <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="Tr ue">
Line 300: alt="Customer Image" />
Line 301:
Line 302: <%# if (DataBinder.Eval(Container
Line 303: {
Line 304: %>
santhimurthyd yours gave me this error
CS1518: Expected class, delegate, enum, interface, or struct
Source Error:
Line 43:
Line 44:
Line 45: <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="Tr
Line 46: <GroupingSettings CaseSensitive="false" />
Line 47: <ClientSettings AllowColumnsReorder="True"
here:
<%# if (DataBinder.Eval(Container.DataItem,"GIS").ToString() == 'yes')
ASKER
sedgwick, sorry I didn't get all of the debug info for you.
The "if" says Invalid expression term if
(DataBinder.Eval(Container .DataItem, "GIS")) says Cannot implicitly convert object to Bool
== says invalid term
and 'yes') says too many characters
Does this have something to do with expressions since we are using the <%# ?
The "if" says Invalid expression term if
(DataBinder.Eval(Container
== says invalid term
and 'yes') says too many characters
Does this have something to do with expressions since we are using the <%# ?
ASKER
the last one says Operator '==' cannot be applied to operands of type 'string'
and 'char' and the "if" still says invalid expression
and 'char' and the "if" still says invalid expression
ASKER
this is defiantly because of the <%# this is defining an expression in the Grid control and although I think it could work for some basic if then I don't think the expression way is going to work because ultimately I am trying to either show a link or not depending if GIS is "yes"
So I took the # off and on this line if (DataBinder.Eval(Container .DataItem, "GIS").ToS tring() == 'yes') and it says "The name Container" is not part of the current context" and 'yes') says too many characters in character literal
In santhimurthyd code if I remove the # the error is different it says "Databinding methods such as Eval() Xpath() and Bind() can only be used in the context of a databound control
so is there any way I can accomplish my task?
So I took the # off and on this line if (DataBinder.Eval(Container
In santhimurthyd code if I remove the # the error is different it says "Databinding methods such as Eval() Xpath() and Bind() can only be used in the context of a databound control
so is there any way I can accomplish my task?
what do u want to display in case DataBinder.Eval(Container. DataItem," GIS") == yes ?
ASKER
A URL link to another page with the ID of that record. so for example
www.mylink.com/thePage.aspx?id=1234
www.mylink.com/thePage.aspx?id=1234
and if not equal to yes?
ASKER
then show nothing or perhaps later an image that says "no GIS layer" or some feedback
add the link inside your aspx page and use the DataBinder.Eval to set the visible attribute of the url:
<a href="www.mylink.com/thePage.aspx?id=1234" Visible='<%# DataBinder.Eval("GIS").ToString() == 'yes' %>'>Next Page</a>
ASKER
I get the error
DataBinder.Eval("GIS")
: CS1012: Too many characters in character literal
and 'yes'
: says too many characters in character literal
DataBinder.Eval("GIS")
: CS1012: Too many characters in character literal
and 'yes'
: says too many characters in character literal
<a href="www.mylink.com/thePage.aspx?id=1234" Visible='<%# DataBinder.Eval(Container.DataItem, "GIS").ToString() == 'yes' %>'>Next Page</a>
ASKER
Thanks for the continued help.. unfortunately that is also giving the error when compiled
CS1012: Too many characters in character literal
in Visual Studio it has the whole line giving the error
"Operator == cannot be applied to operands of type string and char
CS1012: Too many characters in character literal
in Visual Studio it has the whole line giving the error
"Operator == cannot be applied to operands of type string and char
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great it works! thanks if I need to make two conditions true for the "yes" to be generated is that possible.. for example GIS = "yes" and PropertyType = "line" is that possible?
<a href="www.mylink.com/thePage.aspx?id=1234" Visible='<%# DataBinder.Eval(Container.DataItem, "GIS").ToString() == "yes" && DataBinder.Eval(Container.DataItem, "PropertyType").ToString() == "line"%>'>Next Page</a>
ASKER
Thanks again Sedgwick, I'll have to test that one as soon as our new field is in the database. So should I assume that there is no way of pulling the data to do an "if then" outside of the expression like I was initially trying to do?
ASKER
I may have spoke too soon as this being the solution. I have noticed that where there are field values that do not have GIS = yes such as GIS = no or is null it does not matter what the data item is, the Visible attribute is always Yes... there is no " If then" logic working. I realized I awarded points already, but hope that you can review this.
Thats weird let me check it again
ASKER
were you able to look at this?
change it to this:
<a href="www.mylink.com/thePage.aspx?id=1234" Visible='<%#
DataBinder.Eval(Container.DataItem, "GIS") != null ? (DataBinder.Eval(Container.DataItem, "GIS").ToString() == "yes" && DataBinder.Eval(Container.DataItem, "PropertyType").ToString() == "line") : false%>'>Next Page</a>
ASKER
Sorry that one errored
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'PropertyType'.
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'PropertyType'.
ASKER
Although the last suggestion does not work, After some more detective work, and although your first example it works ID: 38835574 and makes the code behind write visible ='True' or False based on the GIS field, however what is happening is that the "Visible" is not behaving. It says True or False in the page source. So I tried lowercase visible and it is still not working. So even if the last suggestion would work, the visible property of the page is not behaving. Boy what a pain in ASP script I could do this and be done with it in a simple 3 line "If then"
the last error with PropertyType, indicate that the row doesn't have a field called PropertyType. can make sure of that?
ASKER
That is correct I do not have a field called PropertyType. Sorry I thought it was added on my version of our code, but wasn't. So my problem is still the link visibility issue. Your code is working in the way you intended, but the link is not being hidden if GIS is not equal to 'yes'
just for testing try this:
<a href="www.mylink.com/thePage.aspx?id=1234" Visible='<%# 1 == 0 %>'>Next Page</a>
ASKER
it shows the link... in the page source it says
<a href="www.mylink.com/thePage.aspx?id=1234" Visible='False'>Next Page2</a>
I figured I would try CSS and use the style visibility and my hard coded test works so I figured I would try a variation of your code
<a style="visibility:<%# System.Convert.ToBoolean(( DataBinder .Eval(Cont ainer.Data Item, "GIS").ToString() =="yes") ? "true":"false") %>" href='http://intranet.domain.org/GISPermit/MCDpermitLocator.html?mcdnum=<%# Eval("MCDNUM") %>&GIS=<%# Eval("GIS") %>' target='_blank'>Go to GIS Map!</a>
The true and false work so I figured I would then try to change them to the proper variables
<a style="visibility:<%# System.Convert.ToBoolean(( DataBinder .Eval(Cont ainer.Data Item, "GIS").ToString() =="yes") ? "visible":"hidden") %>" href='http://intranet.domain.org/GISPermit/MCDpermitLocator.html?mcdnum=<%# Eval("MCDNUM") %>&GIS=<%# Eval("GIS") %>' target='_blank'>Go to GIS Map!</a>
Same exact code except the visible and hidden changed... and I get an odd error
String was not recognized as a valid Boolean.
if I can get this one to work I think I am done..
<a href="www.mylink.com/thePage.aspx?id=1234" Visible='False'>Next Page2</a>
I figured I would try CSS and use the style visibility and my hard coded test works so I figured I would try a variation of your code
<a style="visibility:<%# System.Convert.ToBoolean((
The true and false work so I figured I would then try to change them to the proper variables
<a style="visibility:<%# System.Convert.ToBoolean((
Same exact code except the visible and hidden changed... and I get an odd error
String was not recognized as a valid Boolean.
if I can get this one to work I think I am done..
ASKER
DUH... I removed the System.Convert.ToBoolean and it works!!!!!
<a style="visibility:<%# ((DataBinder.Eval(Containe r.DataItem , "GIS").ToString() =="yes") ? "visible":"hidden") %>" href='http://intranet.domain.org/GISPermit/MCDpermitLocator.html?mcdnum=<%# Eval("MCDNUM") %>&GIS=<%# Eval("GIS") %>' target='_blank'>Go to GIS Map!</a>
<a style="visibility:<%# ((DataBinder.Eval(Containe
jesus christ ;-|
i've missed the System.Convert.ToBoolean code, sorry
i've missed the System.Convert.ToBoolean code, sorry
ASKER
no big deal.. I'm still learning all this so for a newbie like me this is a good learning experience!.. I can't find anywhere the people c# syntax for expressions in a Grid so most of my tests were copy, paste, change and test...
Open in new window