public void Clear_Asset()
    {
        try
        {
            AMS_SW_Vendor.Text            = AMS_SW_Asset_Version.Text = LicenseNumber.Text = LicenseServerDetails.Text = VendorContact.Text = VendorMail.Text =
                Asset_Remarks.Text        = AMS_Asset_Cost.Text = AMS_Asset_Name.Text = String.Empty.ToString();
            AMS_Date_of_Purchase.Text     = "";
            AMS_SW_NumofdaysforTrial.Text = "00";
            AMSCategory.SelectedIndex     = AMS_SW_License_Type.SelectedIndex = 0;
            AMS_Asset_Name.Focus();

            //Response.Redirect("SoftwareAssets.aspx");
        }

        catch (Exception ex)
        {
            //string message = string.Format("Message: {0}\\n\\n", ex.Message);
            //message += string.Format("StackTrace: {0}\\n\\n", ex.StackTrace.Replace(Environment.NewLine, string.Empty));
            //message += string.Format("Source: {0}\\n\\n", ex.Source.Replace(Environment.NewLine, string.Empty));
            //message += string.Format("TargetSite: {0}", ex.TargetSite.ToString().Replace(Environment.NewLine, string.Empty));
            ////ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"" + message + "\");", true);
            //Session["eswar"] = message;

            //Session["pagename"] = "SoftwareAssets.aspx";
            //Response.Redirect("Errorpage.aspx");
        }
    }
    protected void AMS_Asset_Name_TextChanged(object sender, EventArgs e)
    {
        Session["SWVersion"] = AMS_Asset_Name.Text;
        if (Page.IsPostBack == true && AMS_Asset_Name.Text != String.Empty.ToString())
        {
            Session["AssetName"] = AMS_Asset_Name.Text;
            try
            {
                SqlConnection con = new SqlConnection(constr);
                con.Open();
                SqlCommand    assetnamecmd   = new SqlCommand("Select SWAssetName from SoftwareDbTable where SWAssetName = '" + AMS_Asset_Name.Text + "'", con);
                SqlCommand    assetvendorcmd = new SqlCommand("Select SWVendor from SoftwareDbTable where SWAssetName = '" + AMS_Asset_Name.Text + "'", con);
                SqlDataReader assetnamedr    = (assetnamecmd.ExecuteReader());
                assetnamedr.Read();

                if (assetnamedr.HasRows)
                {
                    assetnamedr.Close();
                    AMS_SW_Vendor.Text     = assetvendorcmd.ExecuteScalar().ToString();
                    AMS_SW_Vendor.ReadOnly = true;
                    AMS_SW_Asset_Version.Focus();
                }
                else if (!assetnamedr.HasRows || AMS_Asset_Name.Text == String.Empty.ToString())
                {
                    assetnamedr.Close();
                    ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Please Enter Valid Data');", true);
                    AMS_Asset_Name.Text = String.Empty.ToString();
                    AMS_SW_Vendor.Text  = String.Empty.ToString();
                    AMS_Asset_Name.Focus();
                }
                con.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }