Kodları lütfen aşağıdaki butonları kullanarak renklendirin. Örnek: <php> echo "Selam Dünya"; </php>
Yardım
karakter kaldı

Gridview DataBound kısmında bir hata alıyorum.

Gridview DataBound kısmında literallerin boş gelmesini istemiyorum.
önce şöyle bir kod yazdım.

int zid = new SY().AK.KullaniciID;
        string zadsad = new SY().AK.Adi + " " + new SY().AK.Soyadi;
        Literal ltSorumluID = e.Row.FindControl("ltSorumluID") as Literal;
        Literal ltSorumluList = e.Row.FindControl("ltSorumluList") as Literal;
        DropDownList drpSorumluKisi = e.Row.FindControl("drpSorumluKisi") as DropDownList;
        if (ltSorumluID == null && ltSorumluList == null)
        {
            if (drpSorumluKisi.SelectedValue == Convert.ToString(-1))
            {
                ltSorumluID.Text = Convert.ToString(zid);
                ltSorumluList.Text = zadsad;
            }
        }


bu patladı bende kontrol etmeden direk alayım dedim.
        int zid = new SY().AK.KullaniciID;
        string zadsad = new SY().AK.Adi + " " + new SY().AK.Soyadi;
        Literal ltSorumluID = e.Row.FindControl("ltSorumluID") as Literal;
        Literal ltSorumluList = e.Row.FindControl("ltSorumluList") as Literal;
        DropDownList drpSorumluKisi = e.Row.FindControl("drpSorumluKisi") as DropDownList;
        if (ltSorumluID == null && ltSorumluList == null)
        {
            ltSorumluID.Text = zid.ToString();
            ltSorumluList.Text = zadsad;
        }        


fakat yine patladı ve şöyle bir hata verdi.

Nesne başvurusu bir nesnenin örneğine ayarlanmadı.

Açıklama: Geçerli web isteği yürütülürken işlenmemiş özel durum oluştu. Lütfen hata ve kod içinde kaynaklandığı yer hakkında daha fazla bilgi almak için yığın izlemesini gözden geçirin.

Özel Durum Ayrıntıları: System.NullReferenceException: Nesne başvurusu bir nesnenin örneğine ayarlanmadı.

Kaynak Hatası:
        if (ltSorumluID == null && ltSorumluList == null)
        {
            ltSorumluID.Text = zid.ToString();
            ltSorumluList.Text = zadsad;
        }
+0
-0
Cevaba KatılıyorumKatılmıyorum
Cevap Yaz Yorum Yaz Arşivime Ekle Takip Et

Cevaplar

Hiç cevap bulunamadı. İlk cevabı siz yazın.