Dinamically Creating Views

3 posts, 0 answers
  1. mvbaffa
    mvbaffa avatar
    102 posts
    Member since:
    Dec 2006

    Posted 24 Mar 2012 Link to this post

    Hi,

    How can I create a View dinamically, that is programatically ???

    Should I use jQuery to insert in the DOM a Div with a data-role="View" ???

    Thanks in advance
  2. Shawn R.
    Shawn R. avatar
    4 posts
    Member since:
    Nov 2008

    Posted 24 Mar 2012 Link to this post

    I've been using a literal control and something like this:

            Dim dt As New DataTable
            Dim strText As String = ""

            Dim i As Integer, ii As Integer
            For i = 0 To SOMETHING
                strText &= "YOUR FOR TITLE FROM ARRAY OR SOMETHING" & "<ul>"
                For ii = 0 To SOMETHINGELSE
                    'Add the reports
                    strText &= "<li><a href='#dates'>YOUR FOR TEXT FROM ARRAY OR SOMETHING</a></li>"
                Next
                strText &= "</ul>"
            Next

            Me.lcLoadReports.Text = strText

    You could use anything or even inject HTML directly (somehow). This example is placing items in an established view as below:

        <div data-role="view" data-title="Reports">
            <ul data-role="listview" data-style="inset" data-type="group">
                <li>
                    <asp:Literal ID="lcLoadReports" runat="server"></asp:Literal>
                </li>
            </ul>
        </div>

    But you could easily adapt it to your needs.

    Shawn

  3. Kendo UI is VS 2017 Ready
  4. mvbaffa
    mvbaffa avatar
    102 posts
    Member since:
    Dec 2006

    Posted 24 Mar 2012 Link to this post

    Hi,

    I will try as soon as I can.

    Thank you very much
Back to Top