Bonjour,
je voulais augmenter la hauteur de certaine lignes de mon Grid...
je ne sais comment faire ?
Merci pr vos reponses
Bonjour,
je voulais augmenter la hauteur de certaine lignes de mon Grid...
je ne sais comment faire ?
Merci pr vos reponses
G pas d'idèe...
C'est facile, tu peux utiliser Event: RowCreated de GridView
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //par exemple ID = 69 if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ID")) == "69") { e.Row.BackColor = System.Drawing.Color.Red; e.Row.Height = 80; } } }
non ca marche pas....aucun changement en utilisant votre code =(
Tres incroyable
je vous donne mon exemple
.aspx Code
.cs Code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 <asp:GridView ID="GridView1" runat="server" onrowcreated="GridView1_RowCreated"> </asp:GridView>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DataBinder(); } } private void DataBinder() { SqlConnection conn = new SqlConnection("Data Source=Server;Initial Catalog=Northwind;User ID=sa;Password=123456;"); string sql = "select * from orders"; SqlDataAdapter da = new SqlDataAdapter(sql, conn); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); } protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (Convert.ToString(System.Web.UI.DataBinder.Eval(e.Row.DataItem, "OrderID")) == "10259") { e.Row.BackColor = System.Drawing.Color.Red; e.Row.Height = 80; } } }
Partager