急!!!DataGride数据绑定问题
页面有一个TreeView控件和一个DataGride控件
每次双击TreeView,DataGride就从数据库获取新的数据
我的DataGirde添加了样式
Dim ts As New DataGridTableStyle
Dim textcol(2) As DataGridTextBoxColumn
ts.MappingName = dtrname
textcol(0) = New DataGridTextBoxColumn
textcol(0).MappingName = "attribute_id"
textcol(0).HeaderText = "Attribute_ID"
textcol(0).Alignment = HorizontalAlignment.Center
textcol(0).Width = 0
ts.GridColumnStyles.Add(textcol(0))
textcol(1) = New DataGridTextBoxColumn
textcol(1).MappingName = "seq"
textcol(1).HeaderText = "Seq No"
textcol(1).Width = 75
textcol(1).ReadOnly = True
ts.GridColumnStyles.Add(textcol(1))
textcol(2) = New DataGridTextBoxColumn
textcol(2).MappingName = "label"
textcol(2).HeaderText = "label"
textcol(2).Width = 145
ts.GridColumnStyles.Add(textcol(2))
dgCategory.TableStyles.Clear()
dgCategory.TableStyles.Add(ts)
问题是
第一次双击TreeView,如过DataGride显示数据比较多,如50条数据,鼠标单击最后一条,如第50条(是seq列)
第二次双击TreeView,如过DataGride显示数据比较少,如10条数据
此时,在DataGride中能看到第一次单击DataGride的单元格(seq列)中的数据
问题点数:20、回复次数:2Top
1 楼hamadou(闵峰--为了理想而奋斗)回复于 2005-08-02 11:36:17 得分 0
如果数据绑定没有改变,那么需要在加载新的(就象你每次双击显示数据)数据时要先把datagrid对应的datatable.rows.clear()Top
2 楼jtl510(九头狼)回复于 2005-08-02 13:17:09 得分 0
谢谢 hamadou(闵峰)的参与,我已经解决了,你的方法是不行的。Top




