lauriemc Posted August 14, 2008 Posted August 14, 2008 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 Quote
Nate Bross Posted August 15, 2008 Posted August 15, 2008 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). Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.