questions about formatting gridview at runtime

A

Adam Sandler

Hello,

My codebehind builds a GridView at runtime and shovels the data off as
a part of a callback...

Dim returnstring As String = String.Empty
Dim gv As New GridView

gv.DataSource = ds
gv.DataBind()
gv.Visible = True

Using sw As New System.IO.StringWriter()
Dim htw As New HtmlTextWriter(sw)
gv.RenderControl(htw)
htw.Flush()
returnstring = returnstring + sw.ToString()
End Using

Dim cbr As New CallbackResult("div", "Div1", "innercontent",
returnstring)
map.CallbackResults.Add(cbr)

The above code works great but I'd like to be able to do some
formatting on the GridView... I can do things like:

gv.BorderColor = Drawing.ColorTranslator.FromHtml("#DEDFDE")
gv.FooterStyle.BackColor =
Drawing.ColorTranslator.FromHtml("#CCCC99")

Taken from the "mocha" pattern. But what about the codebehind
equivalents of this markup:

<asp:CommandField ShowSelectButton="True" />

--or--

<asp:BoundField DataField="DateTime" HeaderText="DateTime"
SortExpression="DateTime" />

??? with regard to the first one, I can only get as far as
gv.Columns.Item.CommandField.?

Suggestions are greatly appreciated. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top