swgdesign
asked on
hide div/panel when datatable is empty
I have a div that I want to hide when the rows.count of a dataset = 0 but my code does not work and the error is telling me the ID of the div is not defined...Any ideas?
I have also tried using a Panel but I get the same issue...
I have also tried using a Panel but I get the same issue...
<div class="detailRow" id="ViewFilesDiv" runat="server">
<div class="leftcol">
<a href='javascript:ViewMaterialVersions(<%#DataBinder.Eval(Container.DataItem, "MaterialID")%>)'><img src="/images/viewfiles.png" /></a></div>
<div class="rightcol">
</div>
<div class="floatfix"></div>
</div>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
BindDetails()
Dim tbMaterialVersion As DataTable = New IMCSelect().getMaterialVersions(-1, DetailId, 1, 0, Application("logMaterials")).Tables(0)
If tbMaterialVersion.Rows.Count = 0 Then
ViewFilesDiv.visible = False
End If
End If
End Sub
ASKER
I am using VB.Net there is no == in vb only in C# and JS!
woops sorry itsearly still
ASKER
Here's the whole source in case I am being stupid and missing something;
The label is in a div within a repeater.
The label is in a div within a repeater.
Partial Class ContentZone_PublicationSummary
Inherits System.Web.UI.Page
Public ReadOnly Property DetailId() As Integer
Get
If String.IsNullOrEmpty(Request.QueryString("Id")) Then
Return 0
Else
Dim _DetailId As Integer = 0
Integer.TryParse(Request.QueryString("Id"), _DetailId)
Return _DetailId
End If
End Get
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim tbPublicationPublication As DataTable = New IMCSelect().getPublications(DetailId, "", 1, 0, Application("logGeneric")).Tables(0)
'If tbPublicationPublication.Rows(0)("").ToString <> "" Then
' lblDownloadFile.text = "sdsdsdd"
'End If
'<a href="/uploads/publications/<%#DataBinder.Eval(Container.DataItem, "PDFFile")%>">Download Summary</a>
repDetails.DataSource = tbPublicationPublication
repDetails.DataBind()
End If
End Sub
End Class
<div class="detailRow" id="divDownloadFile">
<div class="leftcol"></div>
<div class="rightcol">
<asp:Label ID="lblDownloadFile" runat="server" Text="Label"></asp:Label></div>
<div class="floatfix"></div>
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Should be
If tbMaterialVersion.Rows.Cou