Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.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
Asp.net 嵌套中继器内的按钮_Asp.net_Vb.net_Repeater_Nested Repeater - Fatal编程技术网

Asp.net 嵌套中继器内的按钮

Asp.net 嵌套中继器内的按钮,asp.net,vb.net,repeater,nested-repeater,Asp.net,Vb.net,Repeater,Nested Repeater,请帮我启动ItemCommand for child Repeater的命令 <asp:Button ID="btnSave" runat="server" OnCommand="btnSave_Command" Text="SAVE" CommandName="SAVE" /> Protected Sub btnSave_Command(ByVal sender As Object, ByVal e As CommandEventArgs) //code End Sub

请帮我启动ItemCommand for child Repeater的命令

<asp:Button ID="btnSave" runat="server" OnCommand="btnSave_Command" Text="SAVE" CommandName="SAVE" />

Protected Sub btnSave_Command(ByVal sender As Object, ByVal e As CommandEventArgs)
    //code
End Sub

<asp:Repeater ID="rpSO" runat="server" OnItemCommand="rpSO_ItemCommand">

Protected Sub rpSO_ItemCommand(ByVal source As Object, ByVal e As RepeaterCommandEventArgs)
    //code
End Sub
这是我的aspx代码

<asp:Repeater ID="rpCompany" runat="server">
    <HeaderTemplate>
        <div id="accordion" class="details-accordion">
    </HeaderTemplate>
    <ItemTemplate>
        <h3 class="details-header clr">
            Company Name
        </h3>
        <div class="col-sm-12 details-content">
            <asp:Repeater ID="rpSO" runat="server">
                <HeaderTemplate>
                    <div id="SO">
                        <div id="accordion2" class="details-accordion">
                </HeaderTemplate>
                <ItemTemplate>
                    <h3 class="details-header clr">
                        SO Number
                    </h3>
                    <div class="col-xs-12 details-content">
                        <div class="col-xs-12 btn-center">
                            <asp:Button ID="btnSave" runat="server" Text="SAVE" CssClass="btn btn-primary btn-blue-save" CommandName="SAVE" />
                        </div>
                        <div class="clr"></div>
                        <div class="col-xs-12">
                            <asp:Label ID="lblErrorSave" runat="server" Text=""></asp:Label>
                        </div>
                    </div>
                </ItemTemplate>
                <FooterTemplate>
                    </div>
                </div>
                </FooterTemplate>
            </asp:Repeater>
        </div>
    </ItemTemplate>
    <FooterTemplate>
        </div>
    </FooterTemplate>
</asp:Repeater>
但它没有开火

我已经在我的儿童中继器上添加了OnItemCommand,但它给了我一个错误

我还在父中继器中添加了
AddHandler rptSO.itemcond、AddressOf rpSO_itemcond
,但仍然没有成功


提前感谢您的帮助。

只需在按钮中添加一个
命令名
,不会使代码隐藏中的事情自动发生。您需要向按钮添加
OnCommand
,或向中继器添加
OnItemCommand

<asp:Button ID="btnSave" runat="server" OnCommand="btnSave_Command" Text="SAVE" CommandName="SAVE" />

Protected Sub btnSave_Command(ByVal sender As Object, ByVal e As CommandEventArgs)
    //code
End Sub

<asp:Repeater ID="rpSO" runat="server" OnItemCommand="rpSO_ItemCommand">

Protected Sub rpSO_ItemCommand(ByVal source As Object, ByVal e As RepeaterCommandEventArgs)
    //code
End Sub

受保护的子btnSave_命令(ByVal sender作为对象,ByVal e作为CommandEventArgs)
//代码
端接头
受保护的子rpSO_ItemCommand(ByVal源作为对象,ByVal e作为RepeaterCommandEventArgs)
//代码
端接头

只需在按钮中添加一个
命令名
,不会使代码隐藏中的事情自动发生。您需要向按钮添加
OnCommand
,或向中继器添加
OnItemCommand

<asp:Button ID="btnSave" runat="server" OnCommand="btnSave_Command" Text="SAVE" CommandName="SAVE" />

Protected Sub btnSave_Command(ByVal sender As Object, ByVal e As CommandEventArgs)
    //code
End Sub

<asp:Repeater ID="rpSO" runat="server" OnItemCommand="rpSO_ItemCommand">

Protected Sub rpSO_ItemCommand(ByVal source As Object, ByVal e As RepeaterCommandEventArgs)
    //code
End Sub

受保护的子btnSave_命令(ByVal sender作为对象,ByVal e作为CommandEventArgs)
//代码
端接头
受保护的子rpSO_ItemCommand(ByVal源作为对象,ByVal e作为RepeaterCommandEventArgs)
//代码
端接头
解决方案:

AddHandler
放入创建的Repeater项中

这个链接帮助我解决我的问题

解决方案:

AddHandler
放入创建的Repeater项中

这个链接帮助我解决我的问题


它给了我描述:在编译为该请求提供服务所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码。编译器错误消息:BC30456:“btn_命令”不是“ASP.viewdetails_aspx”的成员。是否重新编译?我使用了一个翻译程序来获取C#o VB。您可以通过删除sub并在页面上键入
OnCommand=
来重新创建sub,visual studio将要求您创建该方法。它给出了描述:在编译服务此请求所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码。编译器错误消息:BC30456:“btn_命令”不是“ASP.viewdetails_aspx”的成员。是否重新编译?我使用了一个翻译程序来获取C#o VB。您可以通过删除sub并在页面上键入
OnCommand=
来重新创建sub,visual studio将要求您创建方法。我会小心的。我们鼓励链接到外部资源,但请在链接周围添加上下文,以便您的其他用户了解它是什么以及为什么存在。始终引用重要链接中最相关的部分,以防无法访问目标站点或永久脱机。我会考虑把相关内容带入你的答案。现在看来,你可能会被否决,我会小心的。我们鼓励链接到外部资源,但请在链接周围添加上下文,以便您的其他用户了解它是什么以及为什么存在。始终引用重要链接中最相关的部分,以防无法访问目标站点或永久脱机。我会考虑把相关内容带入你的答案。就目前情况而言,你可能会被否决。