call a function in vb code from aspx page

Last post 09-02-2008 12:16 AM by ras_new1. 2 replies.

Sort Posts:

  • call a function in vb code from aspx page

    09-01-2008, 3:04 AM
    • Member
      2 point Member
    • ras_new1
    • Member since 08-01-2008, 8:19 AM
    • Posts 29

    I am using asp.net version 2003 using vb as code behind.

    How can i call a function written in my vb code behind
    inside my .aspx page ie,
    I have to fill a dropdown box with some hard coded items( not in database)
    in one case and some other hard coded items in another case.

    1. How can i dynamically change the content from code behind and make it list
        in a .aspx page?

    2. how can I call a function written in my code behind
        from the asp  page.ie, if I have to make a table hidden and visible based on a condition.
    I have written the vb function as below
    Public Function getVisible()
            Dim clType As String
          
            If Request("btype") <> "" Then
                If Request("btype").Trim = "one" Then

                    clType = "visibility:hidden"
                End If
            Else
                clType = "visibility:visible'"
            End If
            Return clType
        End Function
    In aspx page I have written

    <TABLE id="Table4" cellSpacing="0" cellPadding="0" width="100%" border="0" style="<%#  getVisible()%>">
    </table>
    How can I make this work.
    Thanks,

  • Re: call a function in vb code from aspx page

    09-01-2008, 5:54 AM
    • Participant
      847 point Participant
    • ganseki
    • Member since 05-18-2006, 9:59 PM
    • England
    • Posts 157

    Put a runat="server" attribute on your <table> tag.

    Simon
    Sharing Knowledge Saves Valuable Time!
    www.sjmdev.com
  • Re: call a function in vb code from aspx page

    09-02-2008, 12:16 AM
    Answer
    • Member
      2 point Member
    • ras_new1
    • Member since 08-01-2008, 8:19 AM
    • Posts 29

    Hi, Still its not working. I did like this...

    <TABLE id="Table4" cellSpacing="0" cellPadding="0" width="100%" border="0"  '<%  Response.Write(getVisible()) %>'>

    Now its working. But I dont know its the right way

    Thanks

Page 1 of 1 (3 items)