Thursday 27 June 2013

ajax reorder list database fill in c# drag the value assign value ajax control toolkit asp.net

ajax reorder list database fill in c# drag and drop assign value ajax control toolkit asp.net : aspx :


 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="jQuery.aspx.cs"
                  Inherits="jQuery"    %>
 <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
                        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
  // AjaxControlToolKit ADD Refrences :

   <%@ Register TagPrefix="ajax" Namespace="AjaxControlToolkit"  
                      Assembly="AjaxControlToolkit" %>

    <html xmlns="http://www.w3.org/1999/xhtml">
       <head runat="server">
       </head>
    <body>
    <form id="form1" runat="server">
       <div>
  // AjaxControlToolKit Use ScriptManager Add

        <ajax:ToolkitScriptManager runat="server">
        </ajax:ToolkitScriptManager>

             
            <asp:UpdatePanel ID="up" runat="server">
                <ContentTemplate>
                    <div class="cssName">



  // AjaxControlToolKit ADD RecorderList :

       <ajax:ReorderList ID="ajaxRecordName" runat="server"  
                         CssClass="callbackStyle
                         PostBackOnReorder="false"
                         DragHandleAlignment="Left"
                         AllowReorder="true">
           <ItemTemplate>
                  <div class="ajxRecDiv">
                        <asp:Label ID="lblRecName" CssClass="lblRecName
                                   runat="server" Text='<%#Bind("Name") %>'>
                         </asp:Label>
                                </div>
            </ItemTemplate>
      </ajax:ReorderList>

            </div>
     </ContentTemplate>
      </asp:UpdatePanel>
        
</div>
    </form>
</body>
</html>



aspx  CS:

    SqlConnection Conn = new  
                     SqlConnection(ConfigurationManager.AppSettings["connections"].ToString());
    SqlDataAdapter da = new SqlDataAdapter();

    DataSet ds = new DataSet();

  // Load 

  protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RecName();
        }

    }

public void RecName()
    {
        Select = "Select * From Register where Name!='' OR Name!=Null Order  
                 By Name ASC";
        da = new SqlDataAdapter(Select,Conn);
        da.Fill(ds);

        ajaxRecordName.DataSource ds;     // ajax RecoredList ID

       
       ajaxRecordName.DataBind();
       
}

// CSS Style :

<style type="text/css">
        .cssName
        {
            /*background-color:Maroon;*/
        }
        .cssName li
        {
            list-style: none;
        }
        .callbackStyle
        {
            width: 250px;
        }
        .ajxRecDiv
        {
           list-style: none;
           margin: 10px; 
           cursor: move;
           border: dashed 1px maroon;
           width: 300px;
           height:30px;
           background-color:Silver;
        }
        .lblRecName
        {
            font-family:Verdana;
            }

    </style>

    ------------------------------------------------------------------
         
                
// ajax RecoredList Using Drag


// ajax RecoredList Drag and value fix

 // Data Base


Wednesday 26 June 2013

dropdownlist comboBox with database fill using asp.net Ajax

dropdownlist comboBox  with database fill using asp.net Ajax :

aspx :

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="jQuery.aspx.cs"
                  Inherits="jQuery"    %>
 <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
                        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
  // AjaxControlToolKit ADD Refrences :

   <%@ Register TagPrefix="ajax" Namespace="AjaxControlToolkit"  
                      Assembly="AjaxControlToolkit" %>

    <html xmlns="http://www.w3.org/1999/xhtml">
       <head runat="server">
       </head>
    <body>
    <form id="form1" runat="server">
       <div>
  // AjaxControlToolKit Use ScriptManager Add

        <ajax:ToolkitScriptManager runat="server">
        </ajax:ToolkitScriptManager>

              Select Name :
 // Ajax COmbo Box
        <ajax:ComboBox ID="ajaxCmbName" runat="server"  
                  AutoPostBack="True" 
                  DropDownStyle="Simple"
                  AutoCompleteMode="SuggestAppend"
                 CaseSensitive="True" 
               ItemInsertLocation="OrdinalValue" >
      </ajax:ComboBox>
 </div>
    </form>
</body>
</html>



aspx  CS:

    SqlConnection Conn = new  
                     SqlConnection(ConfigurationManager.AppSettings["connections"].ToString());
    SqlDataAdapter da = new SqlDataAdapter();

    DataSet ds = new DataSet();

  // Load 

  protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            drpName();
        }

    }

public void drpName()
    {
        Select = "Select * From Register where Name!='' OR Name!=Null Order  
                 By Name ASC";
        da = new SqlDataAdapter(Select,Conn);
        da.Fill(ds);

        ajaxCmbName.DataSource = ds;     // ajax comboBox ID

        ajaxCmbName.DataTextField = "Name";    // Name DataFieldName

        ajaxCmbName.DataBind();
       
}





 // Data Base



Monday 24 June 2013

WebService Creating and Consuming WebService in asp.net or Create and call webservice in asp.net

WebService Creating and Consuming WebService in asp.net or Create and call webservice in asp.net  :


1.Create Webservices use The Link:


2Webservices Page Create and Then

  Solution Right Click --- > Add Web Reference 


 3. Web Services in this solution 



4 . Use Web Services Solution Select --- >  SampleWebservices.asmx                   



5 .Add Refrences  Web Services Select [WebMethod] --- > Add Refrences                    

6 .Refrences  Web Services Page in Add--- >


 Call webservice in asp.net  :

  <div align="center">
        A :
        <asp:TextBox ID="txtA" runat="server"></asp:TextBox>
        <br />
        B :
        <asp:TextBox ID="txtB" runat="server"></asp:TextBox>
        <br />
        <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" />
        <br />
        <span style="color:Red;font-weight:bold">ANS:</span>
        <asp:Label ID="lblAns" runat="server"></asp:Label>
    </div>

aspx CS:

protected void btnAdd_Click(object sender, EventArgs e)
    {

       int x, y, Ans;
         x =Convert.ToInt32(txtA.Text);
        y =Convert.ToInt32(txtB.Text);

//Add Webservices (Use This Webservices)
        SampleWebservices objWebServicesAdd = new     
                                                                               SampleWebservices();
        //objWebServicesAdd.Add(x,y);

        Ans = Convert.ToInt32(objWebServicesAdd.Add(x, y));
        lblAns.Text =Convert.ToString(Ans);
            
    }























              









Sunday 23 June 2013

web service create asp net

web service create asp net :


1. Solution Right Click  --- >  Add New Item --- > Web Service
                                                                                   (webservice.asmx)



2. Create a File App_Code --- >
                      (Webservices.cs)
  3.Create a File Webservices Page asmx --- >
                      (Webservices.asmx)



 4.Webservices.cs Page :[WebMethod]




 5.[WebMethod].New [WebMethod] are Create in   ADD   
            
    
 [WebMethod]  //WebMethod New Create
    int Sum;

    public int Add(int a,int b)
    {
        Sum = a+b;
        return Sum;
    }



  Run The Webservices Page : 
 URL:(http://localhost:1234/Sample/SampleWebservices.asmx)
                                                      Add  Click --- > 


ANS:






Friday 21 June 2013

select null,empty value Display in sql

select null,empty value Display in sql :


Select:
             Select  
* From Register





Select Null Value :

             
Select  *  From Register Where Name=Null
                     (Name=Null Values are Not)

            Select  *  From Register Where Name  is Null  or Name=' '


Select Null Value and Use :

        Select  *  From Register Where (Name='' OR Name is  NUll

                                                    and (Age is null or Age='' OR Age=0)












Monday 17 June 2013

gridview Edit,Update,Delete in asp.net

simple gridview Edit,Update,Delete in asp.net

aspx:


  <div align="center">
      <asp:GridView ID="grdRegView" runat="server"></asp:GridView>
  </div>



 
AutoFormat  -- >:                          
Select Color Theme                 

 
      Bound Fields  -- >ADD  -- >HeaderText &DataField

HeaderText and Data TextField :                        Edit Update Delete Command Select:


aspx:
<asp:GridView ID="grdRegView" runat="server" AutoGenerateColumns="False" 
            BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" 
            CellPadding="4" GridLines="Horizontal" 
            onrowediting="grdRegView_RowEditing"   // Row Editing
            onrowcancelingedit="grdRegView_RowCancelingEdit"   // Row CancelEdit
            onrowupdating="grdRegView_RowUpdating" AllowPaging="True"   //Row Update
            onpageindexchanging="grdRegView_PageIndexChanging"      // Page Indexing 
            onrowdeleting="grdRegView_RowDeleting"       //Row Deleting
            PageSize="5"       //Page Size
            >
        <RowStyle BackColor="White" ForeColor="#333333" />
        <Columns>
            <asp:TemplateField HeaderText="ID">
          <%-- <EditItemTemplate>
                     <asp:TextBox ID="txtID" runat="server" Text='<%# Bind("ID") %>'></asp:TextBox>
                </EditItemTemplate>--%>
                <ItemTemplate>
                     <asp:Label ID="lblID" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name">
                <EditItemTemplate>
                    <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label  ID="lblName" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField  HeaderText="Age">
                <EditItemTemplate>
                    <asp:TextBox ID="txtAge" runat="server" Text='<%# Bind("Age") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label  ID="lblAge" runat="server" Text='<%# Bind("Age") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Salary">
                <EditItemTemplate>
                    <asp:TextBox ID="txtSalary" runat="server" Text='<%# Bind("Salary") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblSalary" runat="server" Text='<%# Bind("Salary") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
             // Edit
            <asp:CommandField HeaderText="Edit" ShowEditButton="True" ShowHeader="True" >
            <ControlStyle BorderColor="#FF3300" BorderStyle="Dashed" 
                BorderWidth="1px" Font-Italic="True" />
            </asp:CommandField>
         // Delete
            <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" 
                ShowHeader="True" >
            <ControlStyle BorderColor="Red" BorderStyle="Dashed" BorderWidth="1px" 
                Font-Italic="True" />
            </asp:CommandField>
        </Columns>
        <FooterStyle BackColor="White" ForeColor="#333333" />
        <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
        </asp:GridView>

aspx:cs :
    SqlConnection Conn = new SqlConnection(ConfigurationManager.AppSettings["connections"]);
    SqlCommand Cmd;
    SqlDataAdapter da;
    DataSet ds = new DataSet();
    DataTable dt = new DataTable();
    string select,Update,Delete;

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            View();
        }
    }
    public void View()
    {
        select = "Select * From Register";
        da = new SqlDataAdapter(select, Conn);
        da.Fill(ds);
        grdRegView.DataSource = ds;
        grdRegView.DataBind();
    }


Edit Update Delete Cancel in GridView :
    

Edit Data--- > :
  protected void grdRegView_RowEditing(object sender, 
                                                                   GridViewEditEventArgs e)
      {
        grdRegView.EditIndex = e.NewEditIndex;    // Edit Click Update and Cancel
        View();
      }
 Update Data--- > :Update Value Text box Type Then Update are Cancel in Value
  protected void grdRegView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label lblID = (Label)grdRegView.Rows[e.RowIndex].FindControl("lblID"); 
                                                                                        // lblID Value are    Get  Use Find Control
       TextBox txtName = (TextBox)grdRegView.Rows[e.RowIndex].FindControl("txtName");
                                                                                       // Textbox Value are Get
       TextBox txtAge = (TextBox)grdRegView.Rows[e.RowIndex].FindControl("txtAge");
       TextBox txtSalary = (TextBox)grdRegView.Rows[e.RowIndex].FindControl("txtSalary");
   //Update The Value

        Update = "Update Register Set  Name='"+txtName.Text+"',
                      Age='"+txtAge.Text+"',Salary='"+txtSalary.Text+"' where ID='"+lblID.Text+"'";
        Cmd = new SqlCommand(Update, Conn);
        Conn.Open();
        Cmd.ExecuteNonQuery();
        Conn.Close();
        View();
    }

Cancel Click --- > 
 protected void grdRegView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        grdRegView.EditIndex = -1;   // Cancel Edit in -1
        View();
    }

Delete The Data--- > 
 protected void grdRegView_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Label lblID = (Label)grdRegView.Rows[e.RowIndex].FindControl("lblID");
                                                                                     // lblID Value are    Get  Use Find Control
        Delete = "Delete  From Register Where ID='"+lblID.Text+"'";
        Cmd = new SqlCommand(Delete , Conn);
        Conn.Open();
        Cmd.ExecuteNonQuery();
        Conn.Close();
        View();
}

Paging :     F4 Click Allow Paging True and Page Size Fix









  protected void grdRegView_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grdRegView.PageIndex = e.NewPageIndex;   //Page Index
        View();
    }