Translate

Wednesday 27 December 2017

html li bullet list, square,circle numbering

The following type can we specify in li these are as follows.
type="1|a|A|i|I|disc|circle|square"

I have create some sample tag as follows.

<ul>
  <li type="1">PABITRA</li>
  <li type="1">ARYA</li>
  <li type="1">BRAJA</li>
</ul>

<ul>
  <li type="a">PABITRA</li>
  <li type="a">ARYA</li>
  <li type="a">BRAJA</li>
</ul>


<ul>
  <li type="A">PABITRA</li>
  <li type="A">ARYA</li>
  <li type="A">BRAJA</li>
</ul>

<ul>
  <li type="i">PABITRA</li>
  <li type="i">ARYA</li>
  <li type="i">BRAJA</li>
</ul>

<ul>
  <li type="I">PABITRA</li>
  <li type="I">ARYA</li>
  <li type="I">BRAJA</li>
</ul>

<ul>
  <li type="disc">PABITRA</li>
  <li type="disc">ARYA</li>
  <li type="disc">BRAJA</li>
</ul>


<ul>
  <li type="square">PABITRA</li>
  <li type="square">ARYA</li>
  <li type="square">BRAJA</li>
</ul>

Friday 15 December 2017

sql : Execute stored procedure with output parameter

Create Procedure :

CREATE PROC USP_ExecuteProcedureWithOutputParameter

   @ApplicationNo  VARCHAR(8), 
   @status        VARCHAR(max) OUTPUT,
   @Remark        VARCHAR(max) OUTPUT   
) AS
BEGIN
SET @status='Application No:'+@ApplicationNo+',assign to status';
SET @Remark='Application No:'+@ApplicationNo+',assign to remark';
END



Execute Procedure 

DECLARE @return_value int,
    @status varchar(max),
    @Remark varchar(max)

EXEC @return_value = USP_ExecuteProcedureWithOutputParameter
@ApplicationNo = N'10001',
@status = @status OUTPUT,
@Remark = @Remark OUTPUT

SELECT @status as N'@status',
@Remark as N'@Remark';
SELECT 'Return Value' = @return_value;

Monday 11 December 2017

c# web service use of web service in c#

Load Dropdownlist using webservice

Key Code:

In class File:
Namespace

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Web.Services;
using System.Configuration;

Code:
[WebMethod]
    public static List<clsDropDownList> GetState(string CountryId)
    {
        List<clsDropDownList> obj = new List<clsDropDownList>();
        string query = "SELECT State_Id, State_Name FROM  Mst_State where Country_Id='" + CountryId + "' ORDER BY State_Id";
        string constr = ConfigurationManager.ConnectionStrings["conn_scert"].ConnectionString;
        using (SqlConnection con = new SqlConnection(constr))
        {
            using (SqlCommand cmd = new SqlCommand(query))
            {
                cmd.CommandType = CommandType.Text;
                cmd.Connection = con;
                con.Open();
                using (SqlDataReader sdr = cmd.ExecuteReader())
                {
                    while (sdr.Read())
                    {
                        obj.Add(new clsDropDownList
                        {
                            Value = sdr["State_Id"].ToString(),
                            Text = sdr["State_Name"].ToString()
                        });
                    }
                }
                con.Close();
                return obj;
            }
        }
    }
    public class clsDropDownList
    {
        public string Value { get; set; }
        public string Text { get; set; }
    }







In ASPX Page:

create a form.


  <form id="form1" runat="server">
    <div>
    <table>
    <tr>
    <td> Select Country</td>
     <td>
       <asp:DropDownList ID="ddlCountry" runat="server">
     <asp:ListItem Value="0">Select</asp:ListItem>
       <asp:ListItem Value="01">India</asp:ListItem>
       <asp:ListItem Value="02">Srilanka</asp:ListItem>
        </asp:DropDownList>
        </td>
    </tr>
    <tr>
    <td> Select State</td>
     <td>
     <asp:DropDownList ID="ddlState" runat="server">
        </asp:DropDownList>
        </td>
    </tr>
     <tr>
    <td></td>
     <td>
    <asp:Button ID="btnSubmit" runat="server" Text="Submit"  />
        </td>
    </tr>
    </table>
    </div>
 
    </form>


Javascript:

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
      <script type="text/javascript">
          $(document).ready(function () {
          // Ducument .redy         
              $("#<%= ddlCountry.ClientID %>").change(function () {
                  var CountryId = $("#<%= ddlCountry.ClientID %>").val();
                  //// $.ajax
                  $.ajax({
                      type: "POST",
                      url: "EntryForm.aspx/GetState",
                      data: '{CountryId:"' + CountryId + '"}',
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      success: function (response) {
                          $("#<%= ddlState.ClientID %>").empty().append('<option selected="selected" value="0">Please select</option>');
                          $.each(response.d, function () {
                              $("#<%= ddlState.ClientID %>").append($("<option></option>").val(this['Value']).html(this['Text']));
                          });
                      },
                      failure: function (response) {
                          alert(response.d);
                      }
                  });
                  /// $.ajax
              });

              $("#<%= btnSubmit.ClientID %>").click(function () {
                  var CountryId = $("#<%= ddlCountry.ClientID %>").val();
                  alert(CountryId);
              });



          });
       
    </script>



Details Code:

In class File:

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Web.Services;
using System.Configuration;
public partial class Forms_EntryForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    [WebMethod]
    public static List<clsDropDownList> GetState(string CountryId)
    {
        List<clsDropDownList> obj = new List<clsDropDownList>();
        string query = "SELECT State_Id, State_Name FROM  Mst_State where Country_Id='" + CountryId + "' ORDER BY State_Id";
        string constr = ConfigurationManager.ConnectionStrings["conn_scert"].ConnectionString;
        using (SqlConnection con = new SqlConnection(constr))
        {
            using (SqlCommand cmd = new SqlCommand(query))
            {
                cmd.CommandType = CommandType.Text;
                cmd.Connection = con;
                con.Open();
                using (SqlDataReader sdr = cmd.ExecuteReader())
                {
                    while (sdr.Read())
                    {
                        obj.Add(new clsDropDownList
                        {
                            Value = sdr["State_Id"].ToString(),
                            Text = sdr["State_Name"].ToString()
                        });
                    }
                }
                con.Close();
                return obj;
            }
        }
    }
    public class clsDropDownList
    {
        public string Value { get; set; }
        public string Text { get; set; }
    }
}




In Aspx File:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EntryForm.aspx.cs" Inherits="Forms_EntryForm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table>
    <tr>
    <td> Select Country</td>
     <td>
       <asp:DropDownList ID="ddlCountry" runat="server">
     <asp:ListItem Value="0">Select</asp:ListItem>
       <asp:ListItem Value="01">India</asp:ListItem>
       <asp:ListItem Value="02">Srilanka</asp:ListItem>
        </asp:DropDownList>
        </td>
    </tr>
    <tr>
    <td> Select State</td>
     <td>
     <asp:DropDownList ID="ddlState" runat="server">
        </asp:DropDownList>
        </td>
    </tr>
     <tr>
    <td></td>
     <td>
    <asp:Button ID="btnSubmit" runat="server" Text="Submit"  />
        </td>
    </tr>
    </table>
    </div>
    <%--<script src="../JS/ajax.googleapis.com.ajax.libs.jquery.1.8.3.jquery.min.js" type="text/javascript"></script>--%>
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
      <script type="text/javascript">
          $(document).ready(function () {
          // Ducument .redy         
              $("#<%= ddlCountry.ClientID %>").change(function () {
                  var CountryId = $("#<%= ddlCountry.ClientID %>").val();
                  //// $.ajax
                  $.ajax({
                      type: "POST",
                      url: "EntryForm.aspx/GetState",
                      data: '{CountryId:"' + CountryId + '"}',
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      success: function (response) {
                          $("#<%= ddlState.ClientID %>").empty().append('<option selected="selected" value="0">Please select</option>');
                          $.each(response.d, function () {
                              $("#<%= ddlState.ClientID %>").append($("<option></option>").val(this['Value']).html(this['Text']));
                          });
                      },
                      failure: function (response) {
                          alert(response.d);
                      }
                  });
                  /// $.ajax
              });

              $("#<%= btnSubmit.ClientID %>").click(function () {
                  var CountryId = $("#<%= ddlCountry.ClientID %>").val();
                  alert(CountryId);
              });



          });
       
    </script>
    </form>
</body>
</html>


Wednesday 6 December 2017