Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > จะทำ gridview ยังไงให้ได้แบบนี้ลองทำหลายอย่างแล้วทำไม่ได้ซักที



 

จะทำ gridview ยังไงให้ได้แบบนี้ลองทำหลายอย่างแล้วทำไม่ได้ซักที

 



Topic : 081573



โพสกระทู้ ( 57 )
บทความ ( 0 )



สถานะออฟไลน์




gridview c# linq

ตัวเลขตามสถานะคือ จำนวนงานในแต่ละสถานะ

รบกวนขอคำแนะนำหรือตัวอย่างหน่อยค่ะ



Tag : .NET, Web (ASP.NET), LINQ, C#, VS 2010 (.NET 4.x)









ประวัติการแก้ไข
2012-07-26 12:29:36
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-07-26 12:28:05 By : Pucca^^ View : 1249 Reply : 2
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ทำพวกใน FindControl ครับ อยากจะกำหนดแบบไหนก็ได้ครับ หรือไม่เปลี่ยนไปใช้ Repeater ดูครับ จะง่ายกว่าเดิมครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-07-26 13:32:58 By : mr.win
 


 

No. 2

Guest


โม header ด้วย event RowCreated

ประมาณว่า remove header เก่าทิ้ง

แล้วสร้าง row header ขึ้นมาใหม่ โดยกำหนด rolspan หรือ colspan เอง

Code (C#)
GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated);


Code (C#)
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            GridView Gv = sender as GridView;
            e.Row.Cells.Clear();

            TableCell Cell1 = new TableCell();
            Cell1.RowSpan = 2;
            Cell1.Text = "#";
            Cell1.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            Cell1.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");

            TableCell Cell2 = new TableCell();
            Cell2.RowSpan = 2;
            Cell2.Text = "Month Name";
            Cell2.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            Cell2.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");

            TableCell Cell3 = new TableCell();
            Cell3.ColumnSpan = 3;
            Cell3.Text = "Tungman";
            Cell3.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            Cell3.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");

            TableCell Cell4 = new TableCell();
            Cell4.RowSpan = 2;
            Cell4.Text = "Delete";
            Cell4.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            Cell4.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");

            GridViewRow Gvr1 = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
            Gvr1.Cells.Add(Cell1);
            Gvr1.Cells.Add(Cell2);
            Gvr1.Cells.Add(Cell3);
            Gvr1.Cells.Add(Cell4);

            TableCell Cell5 = new TableCell();
            Cell5.Text = "Sub #1";
            Cell5.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            Cell5.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");

            TableCell Cell6 = new TableCell();
            Cell6.Text = "Sub #2";
            Cell6.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            Cell6.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");

            TableCell Cell7 = new TableCell();
            Cell7.Text = "Sub #3";
            Cell7.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            Cell7.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");

            GridViewRow Gvr2 = new GridViewRow(1, 0, DataControlRowType.Header, DataControlRowState.Insert);
            Gvr2.Cells.Add(Cell5);
            Gvr2.Cells.Add(Cell6);
            Gvr2.Cells.Add(Cell7);
            
            Gv.Controls[0].Controls.AddAt(0, Gvr1);
            Gv.Controls[0].Controls.AddAt(1, Gvr2);
        }
    }

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-07-26 13:55:13 By : อิอิ
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : จะทำ gridview ยังไงให้ได้แบบนี้ลองทำหลายอย่างแล้วทำไม่ได้ซักที
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่