TextBox only numbers

1 Eki 2020 In:
onkeydown="return ( event.ctrlKey || event.altKey || (47<event.keyCode && event.keyCode<58 && event.shiftKey==false) || (95<event.keyCode && event.keyCode<106) || (event.keyCode==8) || (event.keyCode==9) || (event.keyCode>34 && event.keyCode<40) || (event.keyCode==46) )"

Kredi kartı textbox

25 Eyl 2020 In:
 <asp:TextBox ID="txt_kartno" runat="server" CssClass="form-control"  placeholder="0000 0000 0000 0000"
 MaxLength="19"
 onkeypress="return isNumberbosluklu(event);"></asp:TextBox> 
 
 
 
 function isNumberbosluklu(evt) {
            evt = (evt) ? evt : window.event;
            console.log(evt.keyCode);
            var charCode = (evt.which) ? evt.which : evt.keyCode;
            //if (charCode == 32) return true;//bosluk ka
            if (charCode > 31 && (charCode < 48 || charCode > 57)) {
                return false;
            }

            //cc için bosluk ekle her 4 karakterde
            var x = document.getElementById("txt_kartno");
            var index = x.value.lastIndexOf(" ");
            var test = x.value.substr(index + 1);
            if (test.length === 4)
                x.value = x.value + " ";

            return true;
        } 
 
 
 
 
 
 
 
 
 
 
/* ESKİSİ  */
 
 
 
 
 
  <asp:TextBox ID="txtLira" CssClass="form-control" type="number" MaxLength="6" Text="0" autocomplete="off" onfocus="tut(this);" onblur="ver(this);" runat="server" onkeypress="return isNumber(event);" Style="text-align: right"></asp:TextBox>  
 
 
 var eski = "";
        function tut(element) {
            eski = element.value;
            element.value = '';
        }

        function ver(element) {
            if ('' == element.value) {
                element.value = eski;
                //  element.style.background = '#FFFFFF';
            }
            // else
            //  element.style.background = '#A9F5BC';

        }
        function isNumber(evt) {
            evt = (evt) ? evt : window.event;
            var charCode = (evt.which) ? evt.which : evt.keyCode;
            if (charCode > 31 && (charCode < 48 || charCode > 57)) {
                return false;
            }
            return true;
        }
 

Call SOAP API with HttpWebRequest

28 Ağu 2020 In:

 
byte[] data = System.Text.Encoding.ASCII.GetBytes("id=1");

            System.Net.WebRequest request = System.Net.HttpWebRequest.Create(
            "http://localhost:54943/api.asmx/usersgetir");
            request.Method = "POST";
            request.ContentLength = data.Length;
            request.ContentType = "application/x-www-form-urlencoded";

            System.IO.Stream str = request.GetRequestStream();
            str.Write(data, 0, data.Length);
            str.Flush();
            System.Net.WebResponse response = request.GetResponse();
            System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
            string result = reader.ReadToEnd();

ASP.Net JSON post with basic auth

25 Ağu 2020 In: .net
string url = "https://zkapigw.xbank.com.tr:8443/api/accountService";

                User user = new xbank.User()
                {
                    associationCode = "195000_XYX_TICARET",
                    startDate = "2019-09-28T00:00:00",
                    endDate = "2019-10-05T00:00:00"
                };
                var json = JsonConvert.SerializeObject(user);

                HttpWebRequest http = (HttpWebRequest)WebRequest.Create(new Uri(url));
                http.Credentials = CredentialCache.DefaultCredentials;
                http.ContentType = "application/json";
                http.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(username + ":" + password));
                http.AllowAutoRedirect = true;
                http.Method = "POST";

                ASCIIEncoding encoding = new ASCIIEncoding();
                Byte[] bytes = encoding.GetBytes(json);

                Stream newStream = http.GetRequestStream();
                newStream.Write(bytes, 0, bytes.Length);
                newStream.Close();

                var response = http.GetResponse();
                var stream = response.GetResponseStream();
                var sr = new StreamReader(stream);
                var responseText = sr.ReadToEnd();

                Hareketler distance = JsonConvert.DeserializeObject<Hareketler>(responseText);

Clean html tags in string

17 Tem 2020 In:
System.Text.RegularExpressions.Regex.Replace("<b >ali< /b>", "<.*?>", string.Empty);

RadioButton in Repeater

12 Haz 2020 In:


            $('input[type=radio]').click(function () {
                $('input[type=radio]').removeAttr("checked");
                $(this).prop('checked', true);
            });
 
 
 

colorbox iframe den parent tetikleme

12 Haz 2020 In:

iframe içerisinde :
 
<input type="button" class="btn btn-primary" value="KAPAT" onclick="modalkapat();"/>
  
 
 <script>
        function modalkapat() {
            //window.parent.$("#ContentPlaceHolder1_lbtn_yenile").click();
            //window.parent.$("#ContentPlaceHolder1_txt_Note").val('asdas');
            window.parent.__doPostBack('ctl00$ContentPlaceHolder1$lbtn_yenile', '');
            parent.jQuery.colorbox.close();
            return false;
        }
 </script> 
 
 
 
veya
 
 
 
    <link rel="stylesheet" href="css/colorbox.css" />
    <script type="text/javascript" src="js/jquery.colorbox.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".iframe").colorbox({ iframe: true, width: "80%", height: "80%", onClosed: function () { __doPostBack('ctl00$ContentPlaceHolder1$lbtn_yenile', ''); }});
        });
    </script> 

How to set max count for multi-select

6 May 2020 In:
 
 
 
 
var maxCount = 3;
$("#typeCheckboxSelect").multiselect({
includeSelectAllOption: true,
enableCaseInsensitiveFiltering: true,
numberDisplayed: 1,
maxHeight: 250,
includeSelectAllOption: false,
onChange: function(option) {
//Get selected count
var selectedCount = $("#typeCheckboxSelect").find("option:selected").length;
//If the selected count is equal to the max allowed count (3 here), then disable any unchecked boxes
if (selectedCount >= maxCount) {
$("#typeCheckboxSelect option:not(:selected)").prop('disabled', true);
$("#typeCheckboxSelect").multiselect('refresh');
alert("Only allowed to select " + maxCount + " options.");
}
//If the selected count is less than the max allowed count (3 here), then set all boxes to enabled
else {
$("#typeCheckboxSelect option:disabled").prop('disabled', false);
$("#typeCheckboxSelect").multiselect('refresh');
}
} 
}); 
 

Ben Kimim ?

Celiker BahceciMerhabalar, ben Çeliker BAHÇECİ. 2004 den beri özel sektörde bilgisayar mühendisligi ve egitmenlik yapıyorum. Yine aynı yılın Ekim ayından beri sitemde .Net ile programlama ve hayat görüşüm ile ilgili makalelerimi yayınlıyorum. Blogum dışında Yazgelistir.com, mobilnedir.com gibi ineta kapsamındaki bir çok siteye Microsoft teknolojileri ile ilgili yazılar yazmaktayım.
Bu site ile sizinde hayatınızı anlamlandırmanızda bir parça katkımın olması dilegiyle...