C# 如何在asp.net的其他变量中存储数据绑定值

C# 如何在asp.net的其他变量中存储数据绑定值,c#,asp.net,ascx,C#,Asp.net,Ascx,在上面的ascx代码中,如何将值存储在其他变量中,或者如何打印ImageUrl路径?使用asp.net的隐藏值控件并将值存储在其上 <asp:DataList ID="dlAssignftp" Visible="false" runat="server" RepeatColumns="5" RepeatDirection="Vertical" HorizontalAlign="left" CellPadding="1" CellSpacing="1" Wid

在上面的ascx代码中,如何将值存储在其他变量中,或者如何打印ImageUrl路径?

使用asp.net的隐藏值控件并将值存储在其上

    <asp:DataList ID="dlAssignftp" Visible="false" runat="server" RepeatColumns="5" RepeatDirection="Vertical"
            HorizontalAlign="left" CellPadding="1" CellSpacing="1" Width="100%">
            <ItemTemplate>
                <ul class="gallery clearfix slideshow">
                    <li>
<a href='<%# DataBinder.Eval (Container.DataItem, "Image Path") %>' rel="prettyPhoto[pp_gal]">                   
                        <asp:Image ImageUrl='<%# DataBinder.Eval (Container.DataItem, "Image Path") %>' ID="imgftp"
                            runat="server" Height="100px" Width="100px" Visible="true" />
                         </a>                         
                    </li>        
                    <asp:RadioButton ID="rbtn_ftpimg" runat="server" Text="Select" TextAlign="Right" AutoPostBack="true" GroupName='<%# DataBinder.Eval (Container.DataItem, "Image Path") %>' OnCheckedChanged="rbtn_ftpimg_Changed" />            
                </ul>                    
            </ItemTemplate>

        </asp:DataList>

要了解更多详情,请阅读

我不确定是否理解您的问题。你试过codebehind的imgftp.ImageUrl吗?实际上,它是一个实时站点,已经显示了使用FTP加载的图像,并且ascx在数据列表中显示了img,我的工作是为每个图像放置单选按钮,因为img和img loc的数量可能会有所不同,并且rB被选中,相应img的详细信息将显示在警报框中,你知道吗?它存储数据绑定值吗?
 <asp:hiddenfield id="ValueHiddenField" value='<%# DataBinder.Eval (Container.DataItem, "Image Path") %>' runat="server"/>
Protected void Item_Bound(Object sender, DataListItemEventArgs e)
      {
         if (e.Item.ItemType == ListItemType.Item || 
             e.Item.ItemType == ListItemType.AlternatingItem)
         {

            // Retrieve the ValueHiddenField control in the current DataListItem.
            HiddenField imgPath = (HiddenField)e.Item.FindControl("ValueHiddenField");
            string path = imgPath.Value;
         }
      }