Saturday, February 12, 2011

Asp.net: Show/Hide Rows


<%@ Page Language="VB" %>
<!DOCTYPE html>

<script runat="server">
    Sub submit(sender As Object, e As EventArgs)
        If row2.Visible = False Then
            row2.Visible = True
        Else
            row2.Visible = False
        End If
    End Sub
</script>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:Button ID="id" Text="Submit" OnClick="submit" runat="server" />
            <div>
                <table border="1">
                    <tr id="row1" runat="server">
                        <td>1</td><td>2</td><td>3</td>
                    </tr>
                    <tr id="row2" runat="server">
                        <td>4</td><td>5</td><td>6</td>
                    </tr>
                    <tr id="row3" runat="server">
                        <td>7</td><td>8</td><td>9</td>
                    </tr>
                    <tr id="row4" runat="server">
                        <td>10</td><td>11</td><td>12</td>
                    </tr>
                </table>
            </div>
        </form>
    </body>
</html>


No comments: