JS ile sayfadaki CheckBox ların kontrolu

22 Şub 2020 In:

function kontrolet()
        {
            var s = 0;

            //$("input[id*='chk_alt']").each(function (i, el) {//It'll be an array of elements});
            $("input[type='checkbox'][id*=chk_alt]:visible").each(function () {
                if (this.checked)
                    s = 1;
            });

            if (s == 0)
            {
                toastr.error('Lütfen bir alt birim seçiniz.');
                return false;
            }
            return confirm('Başvurunuz yapılacak onaylıyor musunuz?');
        }
 
 
 
 
 
 
OnClientClick="return kontrolet()"

SB Admin 2 Mobile View

11 Oca 2020 In:
<script>
        $(document).ready(function () {
            var w = $(window).width();
            if (w <= 500) {
                $(".accordion").addClass("toggled");
                $(".container-fluid").addClass("pl-0");
                $(".container-fluid").addClass("pr-0");
                $(".card-body").addClass("pl-1");
                $(".card-body").addClass("pr-1");
                $(".card-body").addClass("pt-1");
            }
        });
    </script>

Repeater da Model ile Item Kullanımı

23 Ara 2019 In:

Class ile DataSource almış bir repeaterda Eval siz kullanım örnegi

 

<asp:Repeater ID="rpt_uYDS00" runat="server" ItemType="StajSY.uYDS00">

                                <ItemTemplate>

                                    <div class="row bilgiler">

                                        <div class="col-sm-4">

                                            <div class="row form-group">

                                                <strong class="semibold">ÖSYM'de YDS Sonucum Var:&nbsp </strong>

                                                <div class="bilgiler">

                                                    <asp:CheckBox ID="chk_YDS" runat="server" Text=""

                                                        Checked='<%#  Item.SistemdeKayitliBilgisiVarMi==1?true:false %>' Enabled="false" />

                                                </div>

                                            </div>

                                        </div>

                                        <div class="col-sm-4">

                                            <div class="row form-group">

                                                <strong class="semibold">Sınav Adı:&nbsp </strong>

                                                <%# Item.SinavAdi %>

                                            </div>

                                        </div>

                                        <div class="col-sm-4">

                                            <div class="row form-group">

                                                <strong class="semibold">Yabancı Dil Adı:&nbsp </strong>

                                                <%# Item.Dil %>

                                            </div>

                                        </div>

                                    </div>

                                    <div class="row bilgiler mt-2">

                                        <div class="col-sm-4">

                                            <div class="row form-group">

                                                <strong class="semibold ">Tarih:&nbsp </strong>

                                                <%# Item.AciklanmaTarihi %>

                                            </div>

                                        </div>

                                        <div class="col-sm-4 ">

                                            <div class="row form-group">

                                                <strong class="semibold ">Puan: &nbsp</strong>

                                                <%# Item.Puan?.ToString("F5") %>

                                            </div>

                                        </div>

                                    </div>

                                </ItemTemplate>

                            </asp:Repeater> 

 

Clear your text for URL Request

12 Mar 2019 In: .net
public static string CleanForURL(string m)
        {
            m = m.Replace("\\", " ").Replace("/", " ").Replace("&"," ").Replace("?"," ").Replace("%", " ");
            char[] s = m.Where(c => (char.IsLetterOrDigit(c) || char.IsWhiteSpace(c) || c == '-')).ToArray();
            return (new string(s)).Trim();
        }

BootBox JS ile Confirm ve Alert

20 Şub 2019 In: ipucu
    <script src="js/bootbox.all.min.js"></script>
 
 
<button id="btn_ydilkaydet_" onclick="sinavyerisec();return false;" value="Seçimi Kaydet" class="btn btn-primary" style="width: 130px"></button>
<asp:Button ID="btn_ydilkaydet" runat="server" Text="Kaydet" style="display:none"  OnClick="btn_ydilkaydet_Click" /> 
 
 
        function sinavyerisec() {
            var ms = "<br>Bu bilgiler kaydedilsin mi?<br>";
            bootbox.confirm({
                message: ms,
                buttons: {
                    confirm: {
                        label: 'Kaydet',
                        className: 'btn-primary'
                    },
                    cancel: {
                        label: 'Vazgeç',
                        className: 'btn-warning'
                    }
                },
                callback: function (result) {
    //if(result){}
    //window.open('<%= ConfigurationManager.AppSettings["failurlsi"] %>'); 
                    $("[id$='btn_ydilkaydet']").click();
                }
            });
                }
 
veya
 

bootbox.confirm("This is the default confirm!", function(result){ console.log('This was logged in the callback: ' + result);  

}); 

 
 
 
//ALERT
 
bootbox.alert("This is the default alert!"); 
 

bootbox.alert({ message: "This is an alert with a callback!", callback: function () { console.log('This was logged in the callback!'); } 

}); 

Cascade dropdown lists with webmethod

3 Oca 2019 In:

On head:

 

 <script type = "text/javascript">

        function PopulateControl(list, control) {

            if (list.length > 0) {

                control.removeAttr("disabled");

                control.empty().append('<option selected="selected" value="0">Lütfen Seçiniz</option>');

                $.each(list, function () {

                    control.append($("<option></option>").val(this['Value']).html(this['Text']));

                });

            }

            else {

                control.empty().append('<option selected="selected" value="0">-<option>');

            }

        }

 

var pageUrl = '<%=ResolveUrl("~/pl_yenicarikart.aspx")%>'

function PopulateGrup() {

    $("#<%=ddl_grupek.ClientID%>").attr("disabled", "disabled");

    console.log($('#<%=ddl_grup.ClientID%>').val());

    if ($('#<%=ddl_grup.ClientID%>').val() == "0") {

        $('#<%=ddl_grupek.ClientID %>').empty().append('<option selected="selected" value="0">Lütfen Seçiniz</option>');

      

    }

    else {

        $('#<%=ddl_grupek.ClientID %>').empty().append('<option selected="selected" value="0">Yükleniyor...</option>');

        $.ajax({

            type: "POST",

            url: pageUrl + '/PopulateGrupEk',

            data: "{'TXTGRUPKOD':'" + $('#<%=ddl_grup.ClientID%>').val() + "'}",

            contentType: "application/json; charset=utf-8",

            dataType: "json",

            success: OnCountriesPopulated,

            failure: function(response) {

                alert(response.d);

            }

        });

    }

}

 

function OnCountriesPopulated(response) {

    PopulateControl(response.d, $("#<%=ddl_grupek.ClientID %>"));

}

 

</script>

 

 ----------------HTML

<tr>

                                <td>Grup</td>

                                <td>

                                    <asp:DropDownList ID="ddl_grup" runat="server" CssClass="custom-select" 

                                        AppendDataBoundItems="true" onchange="PopulateGrup();">

                                    </asp:DropDownList></td>

                            </tr>

                            <tr>

                                <td>Ek Grup</td>

                                <td>

                                    <asp:DropDownList ID="ddl_grupek" runat="server" CssClass="custom-select">

                                    </asp:DropDownList></td>

                            </tr>

 

 

 

----------------------------

 

        [System.Web.Services.WebMethod]

        public static ArrayList PopulateGrupEk(string TXTGRUPKOD)

        {

            ArrayList list = new ArrayList();

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SBDB"].ConnectionString))

            {

                using (SqlCommand cmd = new SqlCommand("select TXTEKGRUPKOD,TXTEKGRUPAD from PanoramaMG where TXTGRUPKOD=@TXTGRUPKOD",con))

                {

                    cmd.CommandType = CommandType.Text;

                    cmd.Parameters.AddWithValue("@TXTGRUPKOD", TXTGRUPKOD);

                    con.Open();

                    SqlDataReader sdr = cmd.ExecuteReader();

                    while (sdr.Read())

                    {

                        list.Add(new ListItem(sdr["TXTEKGRUPAD"].ToString(),sdr["TXTEKGRUPKOD"].ToString()));

                    }

                    con.Close();

                    return list;

                }

            }

        }

 

in ASP.Net

 

        private void PopulateDropDownList(ArrayList list, DropDownList ddl)

        {

            ddl.DataSource = list;

            ddl.DataTextField = "Text";

            ddl.DataValueField = "Value";

            ddl.DataBind();

        }

    } 

 

 

 

Source :   https://www.aspsnippets.com/Articles/AJAX-Cascading-DropDownList-using-jQuery-in-ASP.Net.aspx 

 

Get QueryString with JS

1 Eyl 2018 In:
Get Request Values from URL :
 
 
<html xmlns="http://www.w3.org/1999/xhtml"><head><script>
function gup(name) {
    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(location.search);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
if(gup('ck')!='')
{window.location.href='http://x/default.aspx?a='+gup('a')+'&b='+gup('b')+'&c='+gup('c');
}else{window.location.href='http://x/default.aspx';};</script></head></html> 
 

Offline Google Font Usage

4 Ağu 2018 In:

Google fontlarını offline kulanım için :

https://google-webfonts-helper.herokuapp.com/fonts/roboto?subsets=latin,latin-ext 

 

/* roboto-regular - latin-ext_latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: url('../fonts/roboto-v18-latin-ext_latin-regular.eot'); /* IE9 Compat Modes */
src: local('Roboto'), local('Roboto-Regular'),
url('../fonts/roboto-v18-latin-ext_latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts/roboto-v18-latin-ext_latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('../fonts/roboto-v18-latin-ext_latin-regular.woff') format('woff'), /* Modern Browsers */
url('../fonts/roboto-v18-latin-ext_latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('../fonts
/roboto-v18-latin-ext_latin-regular.svg#Roboto') format('svg'); /* Legacy iOS */ 

} 

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...