Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am in the process of re-writing a vb.net windows application into a vb.net web application. I have a problem.

 

In the vb.net windows app I used the DataGridTableStyle to successfully format a grid (datagrid) within code. The code looked something like this:

 

Dim dgts1 As New DataGridTableStyle

With dgts1

.MappingName = sptable

End With

 

Dim grdColumn1 As New DataGridTextBoxColumn

With grdColumn1

.MappingName = "Unit_Number" ' mapping to SQL Server column name

.HeaderText = "Unit"

.Width = 45

End With

dgts1.GridColumnStyles.Add(grdColumn1)

 

And so on......

 

but in the web development environment, it is not recognizing the DataGridTableStyle. So my question is, what can I use in place of it, so that I can format my 'gridview' in code.

 

Thank you,

lauriemc

Posted

Are you using the DataGrid or the GridView?

 

My memory is fuzzy on DataGrid, but GridView [which is very much the same only better] works like this:

 

<ItemStyle-Width="45" />

 

Use that inside your item templates.

 

I'm sure you can access the properties from CodeBehind -- check the intelisense on your gridview item. (I'd use the OnRowDataBinding Event).

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...