Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
Align Width for Child Band
posted

Hi,

              Can anyone tell how to align the width for displaying Child Band using Web Hierarchical Data Grid. ?

The below code is written in Page_Load() in VB.NET

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Dim

 

 

webgriddataset As New

System.Data.DataSet

 

 

Dim sqlconn As

SqlClient.SqlConnection

 

sqlconn =

 

New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ASTNextDevConnectionString").ToString())

sqlconn.Open()

 

 

Dim spName = "sp_WebhierDGSample"

 

 

Dim sqlDA As SqlClient.SqlDataAdapter = New

SqlClient.SqlDataAdapter(spName, sqlconn)

sqlDA.Fill(webgriddataset,

"T1")

 

SqlDataSource1_view1.DataSource = webgriddataset.Tables(0)

SqlDataSource2_view1.DataSource = webgriddataset.Tables(1)

 

 

Dim bf(5) As BoundDataField

 

 

Dim i As Integer

 

 

For i = 0 To 1

bf(i) =

New BoundDataField

bf(i).DataFieldName = webgriddataset.Tables(0).Columns(i).Caption

bf(i).Key =

"Key" & i

bf(i).Header.Text = webgriddataset.Tables(0).Columns(i).Caption.ToLower()

 

 

'Dim scs1 = New SortingColumnSetting

 

 

'scs1.ColumnKey = bf(i).Key

 

 

'scs1.Sortable = True

 

 

'WebHierarchicalDataGrid1.Behaviors.Sorting.ColumnSettings.Add(scs1)

WebHierarchicalDataGrid1.Columns.Add(bf(i))

 

 

 

Next

 

 

Dim childwidth As

Integer

childwidth = 300

 

 

WebHierarchicalDataGrid1.Columns(0).Width = 50

WebHierarchicalDataGrid1.Columns(1).Width = 200

WebHierarchicalDataGrid1.Columns(2).Width = 100

 

WebHierarchicalDataGrid1.DataSource = WebHierarchicalDataSource1

 

 

WebHierarchicalDataGrid1.DataBind()

 

 

Plz.. Go thro' and suggest solutions!!

 

Parents
No Data
Reply
  • 100
    posted

    Hi all,

              I found the solution. I forgot to give the DataMember Name. I dynamically create bands and i try to add bound fields. Now it works Fine.

    New problemi face is that all columns shown twice even autogenerate columns set to false.

     

    Help me Plz.........?!!!!!!!!!!!!!

Children
No Data