VisibleRowCount 为ASPxGridview控件的记录行数模板中获取值
ASPxCheckBox checkBox= (ASPxCheckBox)this.gridColumns.FindRowCellTemplateControlByKey((“Code”,
(GridViewDataColumn)this.gridColumns.Columns["Visible"],"chkVisibleColumn");
boo isVisible =checkBox.Checked;
是解决闪烁问题,可能是我说的不明白吧,问题已解决,在ASPxGridview上面加<divstyle="overflow:auto">解决刷新时不闪烁。现在还有就是列很多,用滚动条拉到最后,数据刷新时,滚动条又回到最前面,显示最前面列的内容而不是原先最后列的内容?只是ASPxGridview局部闪烁,滚动条只是控制ASPxGridview,怎么做到,刷新数据时滚动条还在原来的位置?而不是回到最前面
----------------------------------------------------------------------------------------------------------------------------
2.聚焦行变更事件。向服务器查询聚焦行的 "EmployeeID" 和 "Notes" 信息,并该信息将返回到OnGetRowValues() 函数
function OnGridFocusedRowChanged() {
grid.GetRowValues(grid.GetFocusedRowIndex(), 'EmployeeID;Notes',OnGetRowValues);
}
// 处理服务器端传回的数据(values是个数组,包含"EmployeeID" 和 "Notes" 值)
function OnGetRowValues(values) {
DetailImage.SetImageUrl("FocusedRow.aspx?Photo=" + values[0]);
DetailNotes.SetText(values[1]);
}
<ClientSideEventsFocusedRowChanged="function(s, e) { OnGridFocusedRowChanged();}"/>
EmployeeID和Notes 分别为列字段;
/
脚本部分:
<scriptlanguage="javascript" type="text/javascript"><!--
functionOnGridFocusedRowChanged() {
grid.GetRowValues(grid.GetFocusedRowIndex(), '序号;作者', OnGetRowValues);
//t=grid.GetRowValues(grid.FocusedRowIndex, "序号").ToString();
}
functionOnGetRowValues(values) {
var notes =document.getElementById("texts");
notes.value = values[0];
}
//--></script>
事件部分:
<ClientSideEventsFocusedRowChanged="function(s, e) { OnGridFocusedRowChanged();}"/>
注意事项:
1、grid.GetRowValues(grid.GetFocusedRowIndex(),'序号;作者',OnGetRowValues);里,字段必须在两个或两个以上,一个是不行的。会出错:undfend。
但是,在服务端事件中,是支持grid.GetRowValues(grid.FocusedRowIndex,"序号").ToString();这样的用法的。
2、document.getElementById("texts");部分,名为texts的控件只能是html控件。取vs自带的服务器控件应该用vart=document.getElementById("<%=TextBox1.ClientID%>");
///
GridView内嵌ASPxGridLookup 控件
<dx:GridViewDataTextColumnName="DK01" Caption="申购档口" VisibleIndex="6" FieldName="DK01"Width="60px">
<DataItemTemplate>
<dx:ASPxGridLookupID="GridGuideAdmin" Width="100%" runat="server"IncrementalFilteringMode="StartsWith"
TextFormatString="{0}"ClientInstanceName="GridGuideAdmin"OnInit="GridGuideAdmin_Init"
KeyFieldName="KEY">
<Columns>
<dx:GridViewDataTextColumn FieldName="KEY" Caption="编码" />
<dx:GridViewDataTextColumn FieldName="DL01" Caption="分部名称" />
</Columns>
</dx:ASPxGridLookup>
</DataItemTemplate>
</dx:GridViewDataTextColumn>
-----------------------------------------------------------------------------------------
在DEV的aspxgridview中不存在gridview中的findcontrol,要找到某个控件用FindRowCellTemplateControl
例如:
HiddenField hf =(HiddenField)ASPxGridView1.FindRowCellTemplateControl(0,(GridViewDataColumn)ASPxGridView1.Columns["shopsname"],"HiddenField3");
DateTime ckdate =DateTime.Parse(hf.Value.ToString());
ASPxGridView1为ASPxGridView控件的ID,FindRowCellTemplateControl中的0为第几行数据,(GridViewDataColumn)ASPxGridView1.Columns["shopsname"]
控件HiddenField3在ASPxGridView1中的shopsname这个列中。HiddenField3为绑定的控件的ID。
FindRowCellTemplateControl(intvisibleIndex, GridViewDataColumn gridViewDataColumn, string id);
第一个参数为数据行,第二个参数为控件所在列FieldName的值,第三个参数为控件的ID
-----------------------------------------------------------------------------
关闭弹出窗体closeaspxpopupwindow
1.在popupwindow所在页面弹出及关闭
<asp:ButtonID="btnShowPopup" runat="server" Text="ShowPopup"OnClientClick="popup.Show(); return false;" />
<dxpc:ASPxPopupControlID="pcPopup" runat="server"ClientInstanceName="popup">
<Controls>
<asp:ButtonID="btnClosePopup" runat="server"Text="ClosePopup" OnClientClick="popup.Hide(); returnfalse;" />
</Controls>
</dxpc:ASPxPopupControl>
2.在popupwindow的内容页面关闭
window.parent.ASPxPopupControl1.Hide();
aspxPopupwindow控件使用
function(s, e) {varwin=PopMain.GetWindowByName('PopWinSelectOrg');PopMain.ShowWindow(win);}