Webdatagrid infragistics无法在单元格内获得用户控件

时间:2013-12-03 12:27:49

标签: c# infragistics webdatagrid

我的页面中有一个infragistics webdatagrid,在该页面的顶部,我有一个带有2个按钮的webdatamenu,一个用于刷新页面,另一个用于保存网格中的数据。 我正在做的是日程安排程序。 这是我的webdatagrid ..

 <ig:WebDataGrid ID="WebDataGridPlaneamentoHorarios"  Visible="false" runat="server" Height="500px" 
    AutoGenerateColumns="False" Width="1300px" BorderColor="#666666" 
        ShowFooter="True"  EnableDataViewState="True" >
  <Columns>
  <ig:BoundDataField DataFieldName="Numero" Key="Numero" Width="100px" Hidden="false">
  <Header Text="Número" />
  </ig:BoundDataField>
  <ig:BoundDataField DataFieldName="Nome" Key="Nome"  Width="100px">
     <Header Text="Nome" />
  </ig:BoundDataField> 
  <ig:BoundDataField DataFieldName="Descricao" Key="Descricao" Width="150px" Hidden="false">
     <Header Text="Profissão" />
     <Footer TemplateId="footerTemplate"   />
  </ig:BoundDataField>
  <ig:TemplateDataField Key="Segmentos" Width="1510px" Hidden="False">
     <ItemTemplate>
        <uc1:Segmento ID="Segmento1" runat="server" />
     </ItemTemplate>
     <HeaderTemplate >
          <uc5:HeaderControl  ID="SegHed" runat="server"/>
     </HeaderTemplate>
     <FooterTemplate >
          <div id="Quant" runat="server"> <uc2:SegNecessidades ID="SegNecessidades" runat="server" /></div>
           <br /><br /> <div  id="Totais" runat="server"><uc2:SegNecessidades ID="SegNecessidades2" runat="server" /></div>
                <br /><br /> 
     </FooterTemplate>
   </ig:TemplateDataField>

        <ig:BoundDataField DataFieldName="IDProfissao"  Width="50px" Hidden="true" Key="IDProfissao">
            <Header Text="IDProfissão" />
        </ig:BoundDataField>

    </Columns>
    <Templates>
        <ig:ItemTemplate ID="WebDataGridPlaneamentoHorariosTemplate2"  runat="server" 
            TemplateID="footerTemplate">
            <Template >
            <uc3:FooterControl ID="FooterC" runat="server" />
            </Template> 
        </ig:ItemTemplate>
      </Templates>
</ig:WebDataGrid>

一切正常,刷新,数据加载......问题是当我尝试保存更改时...

protected void WebDataMenuOptions_ItemClick(object sender, Infragistics.Web.UI.NavigationControls.DataMenuItemEventArgs e)
    {
    if (e.Item.Key == "btnRefrescar")
        {
        foreach (GridRecord row in WebDataGridPlaneamentoHorarios.Rows)
                {
                    GridRecordItem itm = row.Items[3];
                    string id = row.Items[0].Text;
                    Control control = itm.FindControl("Segmento1");
                    DataTable DTblHorarioById = dbcHorariosEscalas.GetHorarioById(id, dt);
                    Segmentos seg = (Segmentos)control;
                    seg.AddSegmento(id, DTblHorarioById);
                    //this is to load the schedule of the user,,,,
                }

        }
    else if(e.Item.Key == "btnGuardar")
        {
               foreach (GridRecord row in WebDataGridPlaneamentoHorarios.Rows)
                {
                    GridRecordItem itm = row.Items[3];
                    string id = row.Items[0].Text;
                    Control control = itm.FindControl("Segmento1");
               }
        }

}

因此两个按钮中的代码相同,我试图找到名为Segmento1的用户控件,即4列中的... 现在代码工作时按下刷新按钮,找到用户控件,但是当我按下按钮保存时,控件为空...问题是什么...我对此很疯狂,因为昨天它正在工作,然后今天它停止了,我认为是代码工作时的编程问题之一,因为他想要停止工作..

0 个答案:

没有答案