首页 新闻 会员 周边 捐助

gridview 编辑需要点两次才生效?EditItemTemplate

0
悬赏园豆:10 [待解决问题]

 

<div>
        <asp:UpdatePanel runat="server" ID="UpdatePanl1">
            <ContentTemplate>
                <asp:GridView ID="gvEdit" runat="server" AllowCustomPaging="false" AllowSorting="false" OnRowEditing="gvEdit_RowEditing" AutoGenerateColumns="false">
                    <Columns>
                        <asp:CommandField ShowEditButton="True" ButtonType="Button" EditText="编辑" />
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <table>
                                    <tr>
                                        <td>prizename</td>
                                        <td>point</td>
                                        <td>number</td>
                                        <td>totalpoint</td>
                                        <td>prizeid</td>
                                    </tr>
                                </table>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <table>
                                    <tr>
                                        <td><%# Eval("prizename") %></td>
                                        <td><%# Eval("point") %></td>
                                        <td><%# Eval("number") %></td>
                                        <td><%# Eval("totalpoint") %></td>
                                        <td><%# Eval("prizeid") %></td>
                                    </tr>
                                </table>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <table>
                                    <tr>
                                        <td>
                                            <asp:TextBox runat="server" ID="prizename" Text='<%# Bind("prizename") %>'></asp:TextBox></td>
                                        <td>
                                            <asp:TextBox runat="server" ID="point" Text='<%# Bind("point") %>'></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" ID="number" Text='<%# Bind("number") %>'></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" ID="totalpoint" Text='<%# Bind("totalpoint") %>'></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" ID="prizeid" Text='<%# Bind("prizeid") %>'></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                            </EditItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

恶人鱼的主页 恶人鱼 | 初学一级 | 园豆:166
提问于:2015-03-17 22:28
< >
分享
所有回答(2)
0

没有看,太多,编辑的事件在哪里呢?

_Vegetables | 园豆:586 (小虾三级) | 2015-03-18 10:05

onrowenditing

支持(0) 反对(0) 恶人鱼 | 园豆:166 (初学一级) | 2015-03-18 12:26
0

onrowenditing的代码呢

羽商宫 | 园豆:2490 (老鸟四级) | 2015-03-19 10:59

后台,写了,执行了。第二次才生效。

支持(0) 反对(0) 恶人鱼 | 园豆:166 (初学一级) | 2015-03-19 12:24

@恶人鱼: 问题已经解决。需要在后面写一个bind();重新绑定一下值就OK了。

支持(0) 反对(0) 恶人鱼 | 园豆:166 (初学一级) | 2015-03-20 11:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册