Monday 12 December 2016

SQL Server : Generate Database Script

Posted by : Manav Pandya
SQL Server - Generate Database Script



SQL Server - Generate Database Script

Hello Readers ...

This is my first Video tutorial about SQL Server 2008 R2 Version


Its shows that how to Generate Database Script File


In sql server management studion follow the process as shown below :

Step : 1  Start SQL Server Management Studio and Connect to Database Engine


Step : 2  Select any database on which you want to create database script file


Step : 3  Right click on selected database and select "Task" option


Step : 4  Select "Generate Script" option and and one window will appear


Step : 5  From appeared window press next button and you will see "Choose Object" , from them select appropriate radio button that tell you that you want to generate script for entire database or partial componenet of database


Step : 6  Press Next , you will see that many option are there like output script file location , save to clipboard etc , select appropriate option as you want 


Step : 7  Summary page retrive that shows final step of script generation information about output file


Step : 8  And press Next , process starts its execution and at the end Script File ".sql" will be generated at your desired location



Thats all ....

Now you have Database Script File ...

Thanks for Reading

You can also find My Article here :






SQL Server , Database , asp.net , MVC , Azure , ASP.NET MVC , Sql Server Tutorial






Read More

Wednesday 7 December 2016

ASP.NET - Populate Group CheckBoxList from SQLDataSource

Posted by : Manav Pandya

 How to populate CheckBoxeList from SqlDataSource in ASP.NET ?


Populate CheckBoxeList with SqlDataSource in ASP.NET 


  • As we know CheckBoxList is a Web control provided in toolbox of Visual Studio within ASP.NET project .
  • Main use of this is that we can give facility to user that they can select multiple Option as they want as per category .
  • Here in this article i am going to use SqlDataSource in ASP.NET to populate data within CheckBoxList 
  • Datasource control contains the items to display in the checkboxlist. after creating DataSource control, developers can call checkboxlist DataBind method to bind the datasource to the checkboxlist control. this method allow developers to programmatically (dynamically) data bind checkboxlist control at run time. 
  • We also can use checkboxlist (DataSourceID) property to specify datasource control using declarative syntax. declarative syntax also support DataTextField and DataValueField properties. 

Check Out My Sql Server Video On YouTube :

Sql Server : How To Generate Database Script File

Following snippet shows demo of the same 


<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
    protected void Button1_Clicked(object sender,System.EventArgs e) {
        Label1.Text = "You have Selected  this :-<br/>";
        foreach (ListItem li in CheckBoxList1.Items){
            if (li.Selected == true){
                Label1.Text += li.Text + "<br/>";
            }
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
 <title>Manav Pandya  CheckBoxList populate with SqlDataSource</title>
     </head>
      <body>
        <form id="form1" runat="server">
            <div>
                <asp:Label ID="Label1" runat="server"></asp:Label>
                <hr />
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AppConnectionString1 %>" SelectCommand="SELECT  [ProductName]  FROM [Products] ">
                </asp:SqlDataSource>
                <asp:CheckBoxList ID="CheckBoxList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="ProductName" RepeatColumns="4" BorderStyle="Solid" BorderColor="Red" BorderWidth="1px">
                </asp:CheckBoxList>
                <asp:Button ID="Button1" runat="server" Text="Vew Selected Products" OnClick="Button1_Clicked" />
                
            </div>
        </form>
    </body>
</html>

Try to run this code by yourself and make changes you want .

Thanks for reading , comment ur query if you have .
basic asp.net mvc tutorials, Free asp.net mvc Tutorials for beginners, mvc, asp.net mvc, .net tutorials, mvc tutorial, mvc tutorials, asp.net mvc tutorials, mvc tutorial, mvc tutorials for Beginners , asp.net mvc Basics, basic mvc, mvc4, mvc5,.net mvc
Read More

Monday 28 November 2016

Don't Just Learn To Code, Learn To Create | Justin Richards | TEDxYouth@...

Posted by : Manav Pandya
Read More

Wednesday 21 September 2016

Delete all Rows from All Available Table in SQL Server

Posted by : Manav Pandya



Delete all Rows from All Available Table in SQL Server

Delete all Rows from All Available Table in SQL Server

In this tutorial you will find that in specific situation you need to delete all rows having in Table in SQL Server , so that i have discuss here basic technique 

So try it and tell me if you have query regarding that



SELECT
'Delete from ' + Table_Catalog + '.' + Table_Schema + '.' + Table_Name + ';' 
FROM INFORMATION_SCHEMA.TABLES
WHERE Table_Type = 'BASE TABLE'
ORDER by TABLE_NAME


Another one is that , if your DB is large and you want to know how many tables are deleted you can write as follow :

SELECT
'Print(''Delete started for ' + Table_Catalog + '.' + Table_Schema + '.' + Table_Name + ''');' +
'Delete from ' + Table_Catalog + '.' + Table_Schema + '.' + Table_Name + ';' +
'Print(''Delete done for ' + Table_Catalog + '.' + Table_Schema + '.' + Table_Name + ''');'  +
'Print(''.............'');'
FROM INFORMATION_SCHEMA.TABLES
WHERE Table_Type = 'BASE TABLE'
ORDER by TABLE_NAME





sql server tips , ASP.NET MVC , MVC , Model View Controller , C# , ASP.NET , AJAX , We API , Silverlight , AngularJS , What is MVC in ASP.NET
Read More

ASP.NET - How to Validate DropdownList Control

Posted by : Manav Pandya

ASP.NET - How to Validate DropdownList

ASP.NET - How to Validate DropdownList Control




  • Here i am going to explain that how to validate [DropdownList] control in ASP.NET
  • Scenario is that when we provide Dropdown in our form , user have yo select one item from given list of items .
  • Problem arise when user will not select any one , and by default initial value is selected

Like :

  • Select city
  • Select one item
  • Select your choice

  
  • To do this we need to set the requiredfieldvalidator ControlToValidate property value to DropDownList control's ID which dropdownlist control we want to validate. requiredfieldvalidator control's InitialValue property get or set the initial value of the associated input control. in this example code dropdownlist initial value is 'Choose One',
  • Because we set this text for the dropdownlist control's first item Text property value. initial value is only used for information only, users need to select any one item from dropdownlist control other than it. 


So here i am giving you a technique to resolve above error / problem.





<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e) {
        Label1.Text = "Your selected item is : " +
            DropDownList1.SelectedItem.Text.ToString();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to validate a DropDownList in asp.net</title>
</head>
<body style="padding:25px">
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">      
            DropDownList Validation
        </h2>      
        <hr width="450" align="left" color="Gainsboro" />
        <asp:Label
            ID="Label1"
            runat="server"
            Font-Bold="true"
            Font-Names="Comic Sans MS"
            ForeColor="ForestGreen"
            Font-Italic="true"
            Font-Size="X-Large"
            />
        <br /><br /><br />
        <asp:DropDownList 
            ID="DropDownList1" 
            runat="server"
            Width="350"    
            Font-Size="X-Large"    
            Font-Names="Comic Sans MS"
            ForeColor="MidnightBlue"
            BackColor="FloralWhite"
            >
            <asp:ListItem Selected="True">Choose One</asp:ListItem>
            <asp:ListItem>BulletedList</asp:ListItem>
            <asp:ListItem>Button</asp:ListItem>
            <asp:ListItem>Calendar</asp:ListItem>
            <asp:ListItem>DataGrid</asp:ListItem>
            <asp:ListItem>DataList</asp:ListItem>
            <asp:ListItem>DataPager</asp:ListItem>
        </asp:DropDownList>
        <asp:RequiredFieldValidator
             ID="RequiredFieldValidator1"
             runat="server"
             ControlToValidate="DropDownList1"
             InitialValue="Choose One"
             ErrorMessage="* Please select an item."
             ForeColor="Red"
             Font-Names="Impact"
             >
        </asp:RequiredFieldValidator>
        <br /><br />
        <asp:Button 
            ID="Button1" 
            runat="server" 
            Text="Validate DropDownList" 
            OnClick="Button1_Click"
            Font-Bold="true"
            Font-Size="Large"
            ForeColor="DodgerBlue"
            Font-Names="Monaco"
            Height="45"
            Width="350"
            />
    </div>
    </form>
</body>
</html>



Its time to execute the code , and test you get your desired solution .

If not feel free to ask me anytime .


basic asp.net mvc tutorials, Free asp.net mvc Tutorials for beginners, mvc, asp.net mvc, .net tutorials, mvc tutorial, mvc tutorials, asp.net mvc tutorials, mvc tutorial, mvc tutorials for Beginners , asp.net mvc Basics, basic mvc, mvc4, mvc5,.net mvc
Read More

ASP.NET - How to Hide-Show Div using Jquery

Posted by : Manav Pandya

ASP.NET Hide Show Div using Jquery


ASP.NET - How to Hide-Show Div using Jquery ?


I am here with another article on Jquery 

This article simply shows that How To Hide or Show (DIV) based on click .

It will be very useful , because we need some functionalities at our site in which some action much needed at client side and reduce load of it .

So here im demonstrating the same as follow :

First step is to add refrence of Javascript


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript">
</script>


Second step is to make some design with CSS


button, .button:visited 
{
 background: #222;
 display: inline-block;
 padding: 5px 10px 6px;
 color: #fff;
 text-decoration: none;
 -moz-border-radius: 6px;
 -webkit-border-radius: 6px;
 -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
 -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
 text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
 border-bottom: 1px solid rgba(0,0,0,0.25);
 font-size: 11px;font-weight: bold;line-height: 1;text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
        background-color: #2981e4;
        top:250px;
        float:left;
        left:150px;
        position:fixed;
 
}

.button:hover {background-color: #2575cf;}
 
.detailDiv 
{
 height:80px;
        width: 400px;
 background: #222;
 display: inline-block;
 padding: 50px 10px 6px;
 color: #fff;
 text-decoration: none;
 -moz-border-radius: 6px;
 -webkit-border-radius: 6px;
 -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
 -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
 text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
 border-bottom: 1px solid rgba(0,0,0,0.25);
 position: relative;
 cursor: pointer
        font-size: 11px;font-weight: bold;line-height: 1;text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
        background-color: #91bd09;
 text-align:center;
}
43.detailDiv:hover {background-color: #749a02;}


Now write following code to see effect on specific DIV



<div class="detailDiv">
 Manav Pandya  Show-Hide Demo using ASP.NET Jquery
</div>
<button class="button">
 Show or Hide div 
</button>


Now add following code that shows hiding of div so we need to add click listener 




<script type="text/javascript">
 $(document).ready(function()
{
         $(".detailDiv").hide();
         $('.button').click(function()
{
 $(".detailDiv").slideToggle();
  }
);
}); 
</script>


We are done ...

Try to run above code and enjoy learning ...

Keep tune in for more updates ...


basic asp.net mvc tutorials, Free asp.net mvc Tutorials for beginners, mvc, asp.net mvc, .net tutorials, mvc tutorial, mvc tutorials, asp.net mvc tutorials, mvc tutorial, mvc tutorials for Beginners , asp.net mvc Basics, basic mvc, mvc4, mvc5,.net mvc


Read More

Tuesday 13 September 2016

ASP.NET : How to use Table

Posted by : Manav Pandya

ASP.NET : How to use Table

ASP.NET : How to use Table 

  • Asp.net table web server control display a table on a web page.
  • It is a .net web server control so we can program it in server code such as add , remove table row, cell programmatically.
  • (TableRow) and (TableCell) web server controls allow us to display content for the table. table server control display tabular data and we can format table server control using it's built in methods and properties.
  • The big difference between (html table) and (asp.net table) server control is that we can manipulate table server control using an object model. generally we should use table server control when we intend to add remove rows and cells (columns) programmatically at run time. 
  • Table server control acts as a parent (container) for TableRows controls. table control's Rows property is a collection of TableRow objects. each TableRow control has a collection named Cells. Cells collection contains TableCell objects. actually table server control display the TableCell controls content.
  • TableCell control's Text property value store any html text. you also can add and display controls inside table cell. 
  • Table have many properties to control it's appearance such as BackColor, ForeColor, BorderColor, BorderWidth, BorderStyle, Height, BackImageUrl, Caption, CellPadding, CellSpacing, CssClass, GridLines, Font, HorizontalAlign, Style, SkinID etc. TableRow and TableCell control support many of these properties as well. even we can change any individual cell's or row's appearance and look. 
  • Table server control can display data from a database. but table control does not provide any property that we can use to directly display database data.
  • The following c# example code describe you more about asp.net table web server control.


<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to use Table in asp.net</title>
</head>
<body style="padding:25px">
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">      
            How to use Table in asp.net
        </h2>      
        <hr width="450" align="left" color="Gainsboro" />
        <asp:Table ID="Table1" 
            runat="server" 
            Font-Size="X-Large" 
            Width="550" 
            Font-Names="Palatino"
            BackColor="Orange"
            BorderColor="DarkRed"
            BorderWidth="2"
            ForeColor="Snow"
            CellPadding="5"
            CellSpacing="5"
            >
            <asp:TableHeaderRow 
                runat="server" 
                ForeColor="Snow"
                BackColor="OliveDrab"
                Font-Bold="true"
                >
                <asp:TableHeaderCell>Serial</asp:TableHeaderCell>
                <asp:TableHeaderCell>Name</asp:TableHeaderCell>
                <asp:TableHeaderCell>Value</asp:TableHeaderCell>
            </asp:TableHeaderRow>
            <asp:TableRow 
                ID="TableRow1" 
                runat="server" 
                BackColor="OrangeRed"
                >
                <asp:TableCell>1</asp:TableCell>
                <asp:TableCell>Azure</asp:TableCell>
                <asp:TableCell>#F0FFFF</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow 
                ID="TableRow2" 
                runat="server" 
                BackColor="DarkOrange"
                >
                <asp:TableCell>2</asp:TableCell>
                <asp:TableCell>Beige</asp:TableCell>
                <asp:TableCell>#F5F5DC</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow 
                ID="TableRow3" 
                runat="server" 
                BackColor="OrangeRed"
                >
                <asp:TableCell>3</asp:TableCell>
                <asp:TableCell>Bisque</asp:TableCell>
                <asp:TableCell>#FFE4C4</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow 
                ID="TableRow4" 
                runat="server" 
                BackColor="DarkOrange"
                >
                <asp:TableCell>4</asp:TableCell>
                <asp:TableCell>Crimson</asp:TableCell>
                <asp:TableCell>#DC143C</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow 
                ID="TableRow5" 
                runat="server" 
                BackColor="OrangeRed"
                >
                <asp:TableCell>5</asp:TableCell>
                <asp:TableCell>Cyan</asp:TableCell>
                <asp:TableCell>#00FFFF</asp:TableCell>
            </asp:TableRow>
            <asp:TableFooterRow 
                runat="server" 
                BackColor="DarkOrange"
                >
                <asp:TableCell 
                    ColumnSpan="3" 
                    HorizontalAlign="Right"
                    Font-Italic="true"
                    >
                    Number of colors 5
                </asp:TableCell>
            </asp:TableFooterRow>
        </asp:Table>
    </div>
    </form>
</body>
</html>


basic asp.net mvc tutorials, Free asp.net mvc Tutorials for beginners, mvc, asp.net mvc, .net tutorials, mvc tutorial, mvc tutorials, asp.net mvc tutorials, mvc tutorial, mvc tutorials for Beginners , asp.net mvc Basics, basic mvc, mvc4, mvc5,.net mvc
Read More

Sunday 11 September 2016

ASP.NET - How to use Treeview Control

Posted by : Manav Pandya


ASP.NET - How to use Treeview Control


ASP.NET - How to use Treeview Control


  • TreeView in ASP.NET is a one of Web Server Control as like Menu Control.
  • Treeview display hierarchical data such as a table of contents or file directory, in a tree structure. treeview control is made up of nodes. we can display static data in treeview by creating a collections of TreeNode elements as children of treeview. 
  • We can bind treeview to a data sorce such as (XmlDataSource) and (SiteMapDataSource). treeview can also be bound to an (XmlDocument ) object or a DataSet object. 
  • Treeview node types are parent node, child node, leaf node and root node. parent node contains other node. child node is contained by another node and leaf node have no children node. root node is not contained by any other node. 
  • Node has two properties Text and Value. text property value display in the browser and the value property is hidden in browser and store any additional data about node. a node can have one mode selection mode or navigation mode. selection mode is default. NavigateUrl property used in navigation mode. 
  • We can customize the treeview appearance. we can apply css or inline styles. treeview can be design by the following node styles HoverNodeStyle, LeafNodeStyle, NodeStyle, ParentNodeStyle, RootNodeStyle and SelectedNodeStyle. treeview also have basic design properties such as BackColor, ForeColor, BorderStyle, BorderColor, BorderWidth, Width, Height CssClass, EnableTheming, SkinID, ExpandDepth, ImageSet etc. 
  • We can customize images that are displayed in treeview by using the following properties CollapseImageUrl, ExpandImageUrl, LineImagesFolder and NoExpandImageUrl.  
  • When user click a node, it can either raise a selection event via postback. or it go to another page if NavigateUrl property is set. if NavigateUrl property is not set, then node clicking raise SelectedNodeChanged event.

Following example shows its usage 


<?xml version="1.0" encoding="utf-8" ?>
<ToolBox>
  <Item Name="Country ">
    <Option Control="India" />
    <Option Control="U.S.A" />
    <Option Control="Australia " />
    <Option Control="Japan" />
    <Option Control="Sri-Lanka" />
  </Item>
  <Item Name="Hobbies">
    <Option Control="Sports" />
    <Option Control="Reading" />
    <Option Control="Solving Puzzle" />
    <Option Control="Talking" />
  </Item>
  <Item Name="Name ">
    <Option Control="Manav Pandya" />
    <Option Control="Pandya Manav" />
  </Item>
  <Item Name="Language ">
    <Option Control="ASP.NET" />
    <Option Control="C#" />
    <Option Control="JAVA" />
  </Item>
</ToolBox>


Now Create Webform Treeview_Demo.aspx as shown below 




<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to use TreeView in asp.net</title>
</head>
<body style="padding:25px">
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">      
            How to use TreeView
        </h2>      
        <hr width="450" align="left" color="Gainsboro" />
        <asp:XmlDataSource 
            ID="XmlDataSource1" 
            runat="server" 
            DataFile="~/App_Data/ASPNETControls.xml"
            >
        </asp:XmlDataSource>
        <asp:TreeView 
            ID="TreeView1" 
            runat="server" 
            DataSourceID="XmlDataSource1"
            >
            <DataBindings>
                <asp:TreeNodeBinding 
                    DataMember="ToolBox" 
                    Text="ASP.NET ToolBox"
                    />
                <asp:TreeNodeBinding 
                    DataMember="Item" 
                    TextField="Name"
                    />
                <asp:TreeNodeBinding 
                    DataMember="Option" 
                    TextField="Control"
                    />
            </DataBindings>
        </asp:TreeView>
    </div>
    </form>
</body>
</html



Great we are done .....

Now press CTRL + F5 and here we go , Tree view is completed and you can see all the element placed well

I hope you may like this one ....



basic asp.net mvc tutorials, Free asp.net mvc Tutorials for beginners, mvc, asp.net mvc, .net tutorials, mvc tutorial, mvc tutorials, asp.net mvc tutorials, mvc tutorial, mvc tutorials for Beginners , asp.net mvc Basics, basic mvc, mvc4, mvc5,.net mvc
Read More