الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

اخفاء عنصر في datagride

مغلق
بدأه musaireae في 24 نوفمبر 2005 · 6 رد · 600 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمه الله و بركاته

الموضوع الذي اسال عنه هو انني اقوم باخفاء عنصر من عناصر datagride على حسب شرط معين ، الطريقة شغالة معي ولكن عندما اخفي العنصر يحدث مشكلة في ترتيب عناصر datagride فاذا اخفيت عنصر على سبيل المثال يحدث ازاحه لعناصر datagride و يكون مكان العنصر الاخير فارغ .

فما الحل .

الكود الذي استخدمتة

private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {	
 	 
 	 if(e.Item.ItemType!=ListItemType.Header && e.Item.ItemType!=ListItemType.Footer)
 	 {

    if(Convert.ToBoolean (e.Item.Cells[11].Text.Trim()) == false)
    {
   	 e.Item.Cells[0].Visible=false;
    }
    
 	 }

 	 

  }

If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.

#2

ضع كود ال datagrid.

MCP

MCTS:.Net Framework 2.0: Web Applications

MCPD:Web Developer

#3

هذا هو الكود ارفقته في ملف

New Folder.zip

If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.

#4

جرب:

e.Item.Cells[0].Attributes["style"] = "display:none";
#5

الكود السابق لا يعمل الا اذا تم اخفاء جميع عناصر العمود داخل في ذلك Header اما اذا كنت اريد فقط اخفاء عنصر من عناصر العمود فتحدث المشكله السابقه و التي هي اختفاء العنصر وعمل ازاحه لعناصر الصف الذي تم فيه الاخفاء . ولتجربه ذلك و اتعديل الخطأ الذي اقوم به هذا هو الكود الذي استخدمه في الاسفل .

افيدوني ....

private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {
 	 if(e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.EditItem || e.Item.ItemType==ListItemType.AlternatingItem)
 	 {
    if(e.Item.Cells[15].Text=="none")
   	 e.Item.Cells[0].Attributes["style"] = "display:none";
 	 }
  }

If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.

#6

يا جماعه افيدوني .....

If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.

#7

يا جماعه تكفون احد يرد على استفساري هل هناك حل لهذه المشكله ام لا .

افيدوني ....

If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.

هذا الموضوع مغلق.

مواضيع مشابهة