Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.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# 从ModalPopupXtender';s小组_C#_Asp.net_Gridview - Fatal编程技术网

C# 从ModalPopupXtender';s小组

C# 从ModalPopupXtender';s小组,c#,asp.net,gridview,C#,Asp.net,Gridview,我有一个GridView和GridView中的一列,该列有一个linkButton,单击即可打开一个modalpopupextender。我可以在popextender面板中绑定数据,但现在我想从该面板检索数据。 我从每个GridRow获取数据,如: foreach (GridViewRow row in MyGridView.Rows) { Label Date = (Label)row.Cells[0].FindControl("DateI

我有一个
GridView
GridView
中的一列,该列有一个
linkButton
,单击即可打开一个
modalpopupextender
。我可以在
popextender
面板中绑定数据,但现在我想从该面板检索数据。 我从每个
GridRow
获取数据,如:

 foreach (GridViewRow row in MyGridView.Rows)
 {                   
     Label Date = (Label)row.Cells[0].FindControl("DateId");
     string date = Date.Text;
     //Code to get linkButton(asp:ModalpopUpextender) and data from  
     //asp:panel of ModalpopUpextender
  }
我到处寻找答案,但没能找到解决问题的办法。
提前感谢。

假设您有这样的设置

<ajaxToolKit:ModalPopupExtender 
            ID="mdlPopup" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlPopup" 
            CancelControlID="btnClose" BackgroundCssClass="modalBackground" />
        <asp:Panel ID="pnlPopup" runat="server" Width="500px" style="display:none">
            <asp:UpdatePanel ID="updPnlCustomerDetail" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Label ID="lblCustomerDetail" runat="server" Text="Customer Detail"  Width="95%" />

                </ContentTemplate>                
            </asp:UpdatePanel>

//然后处理标签。

谢谢你的有用帖子…最后我找到了解决方案

Panel.FindControl("ControlId");
无法正常工作,因为somtimes面板未添加到页面

我们可以使用这个代码,它工作得很好

foreach( Control cntrl in Panel.Controls ) 
{   
  if(cntrl.ID == "RequiredConteolId")    
   {
      //your application code goes here...
   } 
}

很好,你找到了解决办法。继续努力。
foreach( Control cntrl in Panel.Controls ) 
{   
  if(cntrl.ID == "RequiredConteolId")    
   {
      //your application code goes here...
   } 
}