Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.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# 来自中继器控件的网络控件失去了它们的值_C#_Asp.net_Repeater_Asprepeater - Fatal编程技术网

C# 来自中继器控件的网络控件失去了它们的值

C# 来自中继器控件的网络控件失去了它们的值,c#,asp.net,repeater,asprepeater,C#,Asp.net,Repeater,Asprepeater,这个问题的解决方案可能就是这篇文章中所说的:然而,对我来说,这是行不通的:| 所以我有一个页面,在这个页面上有一个中继器,它有3个网络控件 <asp:Repeater ID="repFissaggio" runat="server" OnItemCreated="repFissaggio_ItemCreated" EnableViewState="true" > <ItemTemplate> <table width="100%">

这个问题的解决方案可能就是这篇文章中所说的:然而,对我来说,这是行不通的:|

所以我有一个页面,在这个页面上有一个中继器,它有3个网络控件

   <asp:Repeater ID="repFissaggio" runat="server" OnItemCreated="repFissaggio_ItemCreated" EnableViewState="true" >
    <ItemTemplate>
        <table width="100%">
            <tr>
                <td style="width:30%;border: gray 1px solid;">
                    <div style="text-align: center; width:100%; border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;border-bottom: gray 1px solid; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;    FONT-WEIGHT: bold; FONT-SIZE: 12px; background-color:gainsboro;">Disegno Articolo</div>
                    <asp:Image runat="server" ImageUrl='<%# GetFileAddress(Container.DataItem) %>' Width='220px' ID="imgDisegnoArt"  EnableViewState="false"></asp:Image>
                </td>
                <td style="width:65%">
                    <div style="text-align: center; width:100%; border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;border-bottom: gray 1px solid; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;    FONT-WEIGHT: bold; FONT-SIZE: 12px; background-color:gainsboro;">Informazioni Articolo</div>
                    <gsc:SchSolettoFinissaggioArticoloUC ID="ucSchSolettoFinissaggioArticolo" runat="server"></gsc:SchSolettoFinissaggioArticoloUC>
                </td>
            </tr>
            <tr>
                <td style="border: gray 1px solid;">
                    <div style="text-align: center; width:100%; border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;border-bottom: gray 1px solid; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;    FONT-WEIGHT: bold; FONT-SIZE: 12px; background-color:gainsboro;">Schema Finissaggio</div>
                    <asp:Image runat="server" ImageUrl='<%# GetFileAddress(Container.DataItem) %>' Width='220px' ID="imgSchedaFissaggio" EnableViewState="false"></asp:Image>
                    <asp:Label ID="divfileName" runat="server" Text='<%# GetFileName(Container.DataItem) %>' style="text-align: center; width:100%"></asp:Label>
                </td>
                <td>
                    <fieldset  style="padding: 10px,10px,10px,10px; border-bottom-width: 5px">
                        <legend>Sistema di Industrializzazione</legend>
                        <gsc:SchSolettoSistemaProdIndusUC ID="ucSchSolettoSistemaIndus" runat="server"></gsc:SchSolettoSistemaProdIndusUC>
                    </fieldset>
                    <br />
                    <fieldset  style="padding: 10px,10px,10px,10px; border-bottom-width: 5px">
                    <legend>Sistema di Produzione</legend>
                        <gsc:SchSolettoSistemaProdIndusUC ID="ucSchSolettoSistemaProd" runat="server"></gsc:SchSolettoSistemaProdIndusUC>
                    </fieldset>
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:Repeater>

在这个中继器上面我有其他的网络控制。当我更改下拉列表的值时,表单被提交。当这种情况发生时,来自中继器的网络控制值将失去其值。 你建议做什么?
谢谢。

我找到了答案:我应该将绑定放在受保护的void repFissaggio_ItemDataBound(object sender,RepeaterItemEventArgs e)中,而不是repFissaggio_itemscreated中。您可以尝试删除if(!IsPostBack)条件,以便每次绑定repeater(也是在回发之后),但请确保所有输入(在WebControl中)的ID都相同,因此,可以从post数据和viewstate中成功检索值。感谢您的回复,我找到了答案:我应该将绑定放在受保护的void repFissaggio_ItemDataBound(对象发送方,RepeaterItemEventArgs e)中,而不是repFissaggio_ItemCreated中
 protected override void InitEditor()
        {
            if (!IsPostBack)
            {
                ...
                repFissaggio.DataSource = SolettoDS.SoleXSchTec;
                repFissaggio.DataBind();
            }

        }