Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# DevExpress gridView-从onRowInserted事件触发javascript警报_C#_Javascript_Asp.net_Gridview_Devexpress - Fatal编程技术网

C# DevExpress gridView-从onRowInserted事件触发javascript警报

C# DevExpress gridView-从onRowInserted事件触发javascript警报,c#,javascript,asp.net,gridview,devexpress,C#,Javascript,Asp.net,Gridview,Devexpress,我在asp updatePanel中有一个DevExpress gridView <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="upWWWGrid" runat="server" UpdateMode="Conditional"> <ContentTemplate> <div> <d

我在asp updatePanel中有一个DevExpress gridView

 <asp:ScriptManager ID="ScriptManager1" runat="server" />
 <asp:UpdatePanel ID="upWWWGrid" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <div>
            <dx:ASPxGridView ID="grdWWW" runat="server" KeyFieldName="WWWID" AutoGenerateColumns="false" Visible="false" OnRowInserting="grdWWW_RowInserting" OnRowInserted="grdWWW_RowInserted">   
                 <Columns>
                    <dx:GridViewCommandColumn VisibleIndex="0" Caption=" ">
                        <ClearFilterButton Visible="True" />
                        <NewButton Visible="true" />
                        <EditButton Visible="true" />
                        <DeleteButton Visible="true" />
                    </dx:GridViewCommandColumn>
                    <dx:GridViewDataColumn FieldName="WWWID" VisibleIndex="1" Caption="WWW ID">
                        <EditFormSettings Visible="False" />
                    </dx:GridViewDataColumn>  
                    <SettingsEditing Mode="EditFormAndDisplayRow" EditFormColumnCount="2" />
                    <SettingsPager PageSize="20" AlwaysShowPager="true" />
                    <SettingsBehavior AllowSort="true" ConfirmDelete="true" />
                    <Settings ShowFilterRow="true" ShowTitlePanel="true" />
                </Columns>
            </dx:ASPxGridView>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>

但该警报似乎从未注册过。我认为问题与gridView使用回调执行所有操作有关。知道如何在创建新记录后触发此警报吗?我遇到的大多数示例都演示了如何使用客户端SelectionChanged事件和onCustomCallback来实现这一点。

您可能可以在行数据绑定事件中为网格注册onclick事件。下面是您可以使用的代码片段

protected void Grid1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{         
}
else if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "alert('I am here')");

您可能可以在行数据绑定事件中为网格注册onclick事件。下面是您可以使用的代码片段

protected void Grid1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{         
}
else if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "alert('I am here')");

您可以尝试以下方法:

protectedvoid Grid\u RowInsertedEvent(对象发送方,ASPxDataInsertedEventArgs e)
{
JSProperties[“cp_RowInserted”]=true;
...
}
//我更喜欢在grid的Init事件处理程序中使用它,但您可以将它放在
//也插入了行
ClientSideEvents.EndCallback=
@“职能(s、e)
{
如果(s.cp_RowInserted!=null)
{
警报(“插入行”);
s、 cp_rowserted=null;
}
};";

您可以尝试以下方法:

protectedvoid Grid\u RowInsertedEvent(对象发送方,ASPxDataInsertedEventArgs e)
{
JSProperties[“cp_RowInserted”]=true;
...
}
//我更喜欢在grid的Init事件处理程序中使用它,但您可以将它放在
//也插入了行
ClientSideEvents.EndCallback=
@“职能(s、e)
{
如果(s.cp_RowInserted!=null)
{
警报(“插入行”);
s、 cp_rowserted=null;
}
};";

行插入不是严格意义上的服务器端吗?或者,它是否足够接近成功回调时触发某些事件?我可以在服务器端事件代码期间运行ScriptManager.RegisterStartupScript(…),但由于gridview执行回调,因此javascript永远不会触发。从技术上讲,我需要一个确认框,根据用户的响应,我需要执行另一个操作。行插入不是严格意义上的服务器端吗?或者,它是否足够接近成功回调时触发某些事件?我可以在服务器端事件代码期间运行ScriptManager.RegisterStartupScript(…),但由于gridview执行回调,因此javascript永远不会触发。从技术上讲,我需要一个确认框,根据用户的回答,我需要执行另一个操作。我也在DevExpress的帮助网站上问了这个问题,他们回答了相同的问题。下面是他们答案的链接:谢谢!我也在DevExpress的帮助网站上问了这个问题,他们的回答是相同的。下面是他们答案的链接:谢谢!