|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Gridview and colspanCan someone easily tell me how to change what the Gridview renders for the
table to get a colspan attribute on selected rows of the table? In my GridView1_RowDataBound event I am checking the contents of a particular cell: If e.Row.Cells(2) = "Something" Then I want to merge columns 2 and 3 into one (<td colspan=2>) End If Thanks, --David Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.Cells(0).Text.Equals("267-41-2394") Then 'append the content of cell # 2 to cell #1 e.Row.Cells(1).Text += " " & e.Row.Cells(2).Text 'set the columnspan e.Row.Cells(1).ColumnSpan = "2" 'remove the second cell e.Row.Cells.Remove(e.Row.Cells(2)) End If End Sub Show quoteHide quote "David D." wrote: > Can someone easily tell me how to change what the Gridview renders for the > table to get a colspan attribute on selected rows of the table? > > In my GridView1_RowDataBound event I am checking the contents of a > particular cell: > > If e.Row.Cells(2) = "Something" Then > I want to merge columns 2 and 3 into one (<td colspan=2>) > End If > > Thanks, --David Great! It was the e.Row.Cells.Remove(e.Row.Cells(2)) that was the secret.
Thanks so much! Show quoteHide quote "Phillip Williams" wrote: > > Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As > System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound > If e.Row.Cells(0).Text.Equals("267-41-2394") Then > 'append the content of cell # 2 to cell #1 > e.Row.Cells(1).Text += " " & e.Row.Cells(2).Text > 'set the columnspan > e.Row.Cells(1).ColumnSpan = "2" > 'remove the second cell > e.Row.Cells.Remove(e.Row.Cells(2)) > > End If > End Sub > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "David D." wrote: > > > Can someone easily tell me how to change what the Gridview renders for the > > table to get a colspan attribute on selected rows of the table? > > > > In my GridView1_RowDataBound event I am checking the contents of a > > particular cell: > > > > If e.Row.Cells(2) = "Something" Then > > I want to merge columns 2 and 3 into one (<td colspan=2>) > > End If > > > > Thanks, --David
Trouble with validator control ? Script not found
Is there a free .GIF software? Trouble with validator control ? script not found Display data in asp:Calendar ASP.NET 2.0 DataView DetailsView ImageField displaying images from Filtering the Asp:FileUpload control Asp.Net 2.0 Bug Scroll position in panel control Adding AutoPostBack to a webcontrol Changing RadioButton's NAme and ID properties using vb.net |
|||||||||||||||||||||||