obout gridview - 使用编辑模板

时间:2014-09-30 10:03:34

标签: asp.net templates gridview obout

大家好,我正在使用obout gridview,我正在尝试为我的网格制作一个编辑模板,我在他们的网站上查找,但我仍然无法解决更新所需行的问题。 当我选择一行进行编辑时,我得到了一个具有不同外观的模板,该模板有4个文本框,应该连接到网格选择行上的4个单元格。问题是那些文本框没有得到更新,甚至当我作为用户填写它们并单击更新时我可以在调试器上看到它们是""的字符串。

这是网格,也许还有其他事情需要做才能解决这个问题?我对此有点新意,提前致谢!

        <cc1:Grid ID="budgetGrid" runat="server"
        EnableTypeValidation="false" CallbackMode="true" Serialize="true"      AutoPostBackOnSelect="false" 
            AllowGrouping="True" FolderStyle="~/styles/premiere_blue"
          OnUpdateCommand="UpdateRecord" 
            DataSourceID="budgetSql" GroupBy="year,departmentName" ShowColumnsFooter="True" 
            ShowGroupFooter="True" ShowMultiPageGroupsInfo="False" 
        AllowAddingRecords="False" PageSize="-1" AllowPageSizeSelection="False" 
        AllowPaging="False">

                     <GroupingSettings AllowChanges="False" />

            <Columns>

                <cc1:Column ID="Column1" runat="server" AllowEdit="true" HeaderText="Edit" 
                    width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                </cc1:Column>
                <cc1:Column ID="column0" HeaderText="ID" readonly="true" Visible="false" runat="server" DataField="id"  FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />

                </cc1:Column>
                <cc1:Column ID="Column2" HeaderText="Department" readonly="true" Visible="false" runat="server" DataField="departmentName" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                </cc1:Column>
                <cc1:Column ID="Column3" HeaderText="Sub Dep" readonly="true" runat="server" DataField="subDepName" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller"  />
                </cc1:Column>

                <cc1:Column ID="Column11" HeaderText="Q1Bud" readonly="false" runat="server" DataField="Q1B" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                    <TemplateSettings RowEditTemplateControlId="budgetQ1" RowEditTemplateControlPropertyName="value" />
                </cc1:Column>
                <cc1:Column ID="Column8" HeaderText="Q2Bud" readonly="false" runat="server" DataField="Q2B" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                    <TemplateSettings RowEditTemplateControlId="budgetQ2" RowEditTemplateControlPropertyName="value" />
                </cc1:Column>
                <cc1:Column ID="Column9" HeaderText="Q3Bud" readonly="false" runat="server" DataField="Q3B" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                    <TemplateSettings RowEditTemplateControlId="budgetQ3" RowEditTemplateControlPropertyName="value" />
                </cc1:Column>
                <cc1:Column ID="Column10" HeaderText="Q4Bud" readonly="false" runat="server" DataField="Q4B" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                    <TemplateSettings RowEditTemplateControlId="budgetQ4" RowEditTemplateControlPropertyName="value" />
                </cc1:Column>


                <cc1:Column ID="Column4" HeaderText="Q1App" readonly="true" runat="server" DataField="Q1A" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                </cc1:Column>
                <cc1:Column ID="Column5" HeaderText="Q2App" readonly="true" runat="server" DataField="Q2A" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                </cc1:Column>
                <cc1:Column ID="Column6" HeaderText="Q3App" readonly="true" runat="server" DataField="Q3A" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                </cc1:Column>
                <cc1:Column ID="Column7" HeaderText="Q4App" readonly="true" runat="server" DataField="Q4A" Width="100" FooterStyle-Font-Size="Smaller">
                    <FooterStyle Font-Size="Smaller" />
                </cc1:Column>

                 <cc1:Column ID="Column13" HeaderText="Year" readonly="true" Visible="false" runat="server" DataField="year" FooterStyle-Font-Size="Smaller" Width="60">
                     <FooterStyle Font-Size="Smaller" />

                </cc1:Column>
            </Columns>

                     <TemplateSettings RowEditTemplateId="tplRowEdit" />

        <Templates>                
            <cc1:GridTemplate runat="server" ID="tplRowEdit">
                <Template>
                    <table class="rowEditTable">
                        <tr>
                            <td valign="top">
                                <fieldset style="width: 275px; height: 175px;">
                                    <legend>Budget Amount</legend>
                                    <table class="rowEditTable">                                                                
                                        <tr> 
                                        <br />
                                            <td>Quarter 1:</td>
                                            <td> <cc1:OboutTextBox runat="server" ID="budgetQ1" Width="150"></cc1:OboutTextBox>

                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Quarter 2:</td>
                                            <td>
                                                <cc1:OboutTextBox runat="server" ID="budgetQ2" Width="150"></cc1:OboutTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Quarter 3:</td>
                                            <td>
                                               <cc1:OboutTextBox runat="server" ID="budgetQ3" Width="150"></cc1:OboutTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Quarter 4:</td>
                                            <td>
                                                <cc1:OboutTextBox runat="server" ID="budgetQ4" Width="150"></cc1:OboutTextBox>
                                            </td>
                                        </tr>                                                               
                                        <tr>
                                            <td colspan="2">
                                                <br />

                                            </td>
                                        </tr>
                                    </table>
                                 </fieldset>
                             </td>
                         </tr>
                         <tr>
                            <td colspan="3" align="center">
                                <input type="button" value="Save" onclick="budgetGrid.save()"  />
                                <input type="button" value="Cancel" onclick="budgetGrid.cancel()"  /> 
                            </td>
                         </tr>
                     </table>                                            
                </Template>
            </cc1:GridTemplate>
        </Templates>

        </cc1:Grid>

1 个答案:

答案 0 :(得分:0)

我前段时间找到了一个解决方案,我从零开始在页面加载事件中创建了gridview,通过这样做我可以完全控制所有更改编辑等,这似乎会导致很多问题,同时尝试使用现有的html视图中的gridview。