带有模态窗口的 AspxGridView,
我有一个 AspxGridView,当我双击一行时,它会显示一个模式窗口。我想要做的是将一列的值发送到位于 ModalWindow 的 AspxLabel。但我无法做到这一点,在 gridview 中我使用 ClientSideEvents RowDblClick 来获取行值。这是代码:
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);
}
感谢您的帮助,
Mehmet Şerif Tozlu
I have a AspxGridView and when i double click to a row, it shows a modal window. What i want to do is, send one columns' value to a AspxLabel which is at ModalWindow. But i couldn't manage to do it, in gridview i use ClientSideEvents RowDblClick to get row value. Here is the code:
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())
}" />
Script:
function ShowModalWindow(val)
{
pcc_Question.Show();
lblCQuestionText.SetText(val);
}
And 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);
}
Thanks for the help,
Mehmet Şerif Tozlu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的代码看起来正确并且应该可以工作。我建议您在 gw_Parameters_CustomDataCallback 方法中设置断点并检查 e.Result 值。另外,根据您的代码,lblCQuestionText 是位于 PopupControl 中的标签的 ClientInstanceName 属性。这是真的吗?
Your code looks correct and should work. I suggest that you set the breakpoint in the gw_Parameters_CustomDataCallback method and check the e.Result value. Also, according to your code, the lblCQuestionText is the ClientInstanceName property of the label residing in the PopupControl. Is it true?
Mehmet,
请尝试此处的结果有几个例子。
Mehmet,
Try the results here which has several examples.