EDUDOTNET

Thursday, September 12, 2013

How To Convert HTML Table In To Div Tag

Using Jquery Convert HTML Table in to Div tag:

Jquery function converting table in to div, see below jquery function:
<script type="text/javascript">
        $('table').replaceWith(function () {
            var html = ''; 
            $('tr'this).each(function () {
                html += '<div>';
                $('td'this).each(function () {
                    html += '<div>' + $(this).html() + '</div>';
                });
                html += '</div>';
            }); 
            return '<div>' + html + '</div>';
        });
</script>
Table :
<table>
        <tr>
            <td width="180" valign="top" id="maintable-toc">
                <div id="toc">
                    <h2>
                        <a id="toc-title" href="index.htm">Table of Contents</a></h2>
                    <ol class="section">
                        <li>
                            <div class="currentpage">
                                Basics</div>
                            <ol>
                                <li><a href="page_02.htm">Pages </a></li>
                                <li><a href="page_03.htm">Sections </a></li>
                                <li><a href="page_04.htm">Headings </a></li>
                            </ol>
                        </li>
                        <li><a href="page_07.htm">Images </a></li>
                    </ol>
                </div>
            </td>
            <td width="*" valign="top" id="maintable-content">
                <div id="main-content-withtoc">
                    <a name="Main"></a>
                    <h2>
                        Basics</h2>
                    <p>This section looks at the basics of work.</p>
                </div>
            </td>
        </tr>
</table>




Friday, September 6, 2013

How to create sql query result to xml file

Create Sql Query Result To XML Format

Sql Query: Getting all users data from sql server in xml file format...

See below Query:

SELECT *
FROM dbo.Users
FOR XML PATH('User'), ROOT ('Users')

Results: (XML Format):

<Users>
  <User>
    <UserID>8eaf6426-63e4-49c7-939e-1b0f43586084</UserID>
    <RoleID>4</RoleID>
    <FirstName>Thomas</FirstName>
    <LastName>Dalm</LastName>
    <Password>iJletJwlcqUrAIC98rggvA==</Password>
    <EmailID>thomas.edu@gmail.com</EmailID>
    <CreatedDate>2013-05-29T06:39:48.217</CreatedDate>
    <IsActive>1</IsActive>
    <CompanyName>EDUDOTNET</CompanyName>
    <LastPasswordChangedDate>2013-07-1T08:31:14.150</LastPasswordChangedDate
  </User>
  <User>
    <UserID>1e922995-d0f9-e211-b767-3c4a92dbc8db</UserID>
    <RoleID>1</RoleID>
    <FirstName>Khumesh</FirstName>
    <LastName>Kumawat</LastName>
    <Password>iJletJwlcqUrAIC98rggvA==</Password>
    <EmailID>khumesh.edu@gmail.com</EmailID>
    <CreatedDate>2013-05-29T06:39:48.217</CreatedDate>
    <IsActive>1</IsActive>
    <CompanyName>EDUDOTNET</CompanyName>
    <LastPasswordChangedDate>2013-07-1T08:31:14.150</LastPasswordChangedDate>
  </User

</Users>