我有一個AspxGridView,當我雙擊一行,它顯示一個模式窗口。我想要做的是,將一列的值發送到ModalWindow中的AspxLabel。但我無法做到這一點,在GridView我使用ClientSideEvents RowDblClick獲取行值。下面是代碼:AspxGridView與模式窗口,
GridView控件:
<dxwgv:ASPxGridView ID="gw_Parameters" runat="server"
CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua"
AutoGenerateColumns="False" ClientInstanceName="grid"
OnCustomDataCallback="gw_Parameters_CustomDataCallback">
<ClientSideEvents RowDblClick="function(s, e) {
grid.GetValuesOnCustomCallback(e.visibleIndex, ShowModalWindow())
}" />
腳本:
function ShowModalWindow(val)
{
pcc_Question.Show();
lblCQuestionText.SetText(val);
}
和C#:
protected void gw_Parameters_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
{
int visibleIndex = Convert.ToInt32(e.Parameters);
string fieldName = string.Empty;
if (gw_Parameters.VisibleColumns[0] is GridViewCommandColumn)
fieldName = ((GridViewDataColumn)gw_Parameters.VisibleColumns[3]).FieldName;
else
fieldName = ((GridViewDataColumn)gw_Parameters.VisibleColumns[2]).FieldName;
e.Result = gw_Parameters.GetRowValues(visibleIndex, fieldName);
}
感謝您的幫助,
穆罕默德襯線Tozlu