aspxgridview中findrowcelltelemplete对控件显示隐藏的识别

//启用编辑模式
                // int rowindex = this.accBooks_wlls.FindVisibleIndexByKeyValue(e.KeyValue);
                int rowsy = e.VisibleIndex;//必须要设置主键
                                           // long id =long.Parse(e.KeyValue.ToString());
                                           //测试e.KeyValue
                

                //列隐藏,等同于该列不存在,查找该列下的对象会出错,但是列不隐藏,内置控件隐藏则下列方法可以正常识别。内置隐藏控件可以放在任意模板列的<DataItemTemplate>中,不能放在绑定了字段的那一列中,否则绑定的字段内容不显示。

 <dx:GridViewDataTextColumn Caption="省市" FieldName="ss" ShowInCustomizationForm="True" VisibleIndex="4" Width="62px">
                                                             <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                                                     <CellStyle HorizontalAlign="Left" VerticalAlign="Middle">
                                                                                     </CellStyle>
                                                            <DataItemTemplate>
                                                                  <dx:ASPxLabel ID="ASPxLabel_gx_dm" runat="server" Visible="false" Text='<%# Eval("dm") %>'></dx:ASPxLabel>
                                                                <dx:ASPxLabel ID="lbl_zyts" runat="server" Visible="false"></dx:ASPxLabel>
                                                            </DataItemTemplate>
                                                        </dx:GridViewDataTextColumn>
                                                        <dx:GridViewCommandColumn Caption="编辑" ShowInCustomizationForm="True" Visible="False" VisibleIndex="7">
                                                        </dx:GridViewCommandColumn>
                                                        <dx:GridViewDataTextColumn Caption=" " ShowInCustomizationForm="True" VisibleIndex="8" Width="40px">
                                                           <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                                                     <CellStyle HorizontalAlign="Left" VerticalAlign="Middle">
                                                                                     </CellStyle>
                                                            <DataItemTemplate>
                                                                <dx:ASPxButton ID="ASPxButton_wlls_gx" runat="server" Text="详情" CommandName="cnb_wlls_gx" 
                                                                    Paddings-Padding="0">
                                                                     <ClientSideEvents Click="function(s, e) {onCallbackStart();}" />
                                                                </dx:ASPxButton>
                                                                 <dx:ASPxLabel ID="ASPxLabel_gx_xxmc" runat="server" Visible="false" Text='<%# Eval("xxmc") %>'></dx:ASPxLabel>
                                                                <dx:ASPxLabel ID="ASPxLabel_gx_pc" runat="server" Visible="false" Text='<%# Eval("pc") %>'></dx:ASPxLabel>
                                                              
                                               
                                                            </DataItemTemplate>
                                                        </dx:GridViewDataTextColumn>


                ASPxLabel l_xxmc = this.accBooks_wlls.FindRowCellTemplateControl(rowsy, null, "ASPxLabel_gx_xxmc") as ASPxLabel;
                ASPxLabel l_xxdm = this.accBooks_wlls.FindRowCellTemplateControl(rowsy, null, "ASPxLabel_gx_dm") as ASPxLabel;
                ASPxLabel l_xxpc = this.accBooks_wlls.FindRowCellTemplateControl(rowsy, null, "ASPxLabel_gx_pc") as ASPxLabel;
                ASPxLabel lbl_ts = this.accBooks_wlls.FindRowCellTemplateControl(rowsy, null, "lbl_zyts") as ASPxLabel;

                this.accBooks_wlls.StartEdit(rowsy);
                //ASPxGridView_zyxq 数据要绑定到这里
                //ViewState["glyxgkcfy002"] = 0;//第一个页面
                ASPxPageControl pagetrol = this.accBooks_wlls.FindEditFormTemplateControl("ASPxPageControl_zyxq") as ASPxPageControl;
                ASPxGridView gv = pagetrol.FindControl("ASPxGridView_zyxq") as ASPxGridView;
                
                //一次性打开这么多,很慢,占用资源,要求在内容页单击【专业】才打开

                string xxmc = l_xxmc.Text.Trim();
                string xxdm = l_xxdm.Text.Trim();
                // string pc = lb_pc.Text.Trim();
                string pc = l_xxpc.Text.Trim();

 

渝公网安备 50011902000225号

渝ICP备18008233号-1