Click here to Skip to main content

Response to: Tow GridView with Buttons have commandnames

Revision 2
First Grid Template Field :
<asp:templatefield xmlns:asp="#unknown">
                    <edititemtemplate>
                        <<asp:Button ID="Update" runat="server" CommandName="Update" Text="Update" />
   <<asp:Button ID="Cancel" runat="server" 
ommandName="Cancel" Text="Cancel" />
                    </edititemtemplate>
                    <itemtemplate>
                           <<asp:Button ID="Edit" runat="server" 
ommandName="Edit" Text="Edit" />
                    </itemtemplate>
                    <footertemplate>
                        <asp:button id="Insert" runat="server" commandname="Insert" text="Insert" />
                    </footertemplate>
                </asp:templatefield>
Second Grid Template Field:
<asp:templatefield xmlns:asp="#unknown">
                    <edititemtemplate>
                        <<asp:Button ID="UpdateS" runat="server" CommandName="Update" Text="Update" />
   <<asp:Button ID="CancelS" runat="server" 
ommandName="Cancel" Text="Cancel" />
                    </edititemtemplate>
                    <itemtemplate>
                           <<asp:Button ID="EditS" runat="server" 
ommandName="Edit" Text="Edit" />
                    </itemtemplate>
                    <footertemplate>
                        <asp:button id="Search" runat="server" commandname="Insert" text="Insert" />
                    </footertemplate>
                </asp:templatefield>
And all the other columsn are the same except my footer which is different in controls type but still has no code so the controls wont matter my Load Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
''Do Connection and bring Data From Access DataBase 
GridView1.DataSourse = DataSet1
GridView1.DataBind()
GridView2.DataSourse = DataSet1
GridView2.DataBind()
End Sub
The rowEditing for the first Grid
Protected Sub GridView1_RowEditing(sender As Object, e As System.Wev.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing


	GridView1.EditIndex = e.NewEditIndex
        GridView1.DataSourse = DataSet1
        GridView1.DataBind()
End Sub

The rowEditing for the Second Grid
Protected Sub GridView2_RowEditing(sender As Object, e As System.Wev.UI.WebControls.GridViewEditEventArgs) Handles GridView2.RowEditing


    GridView2.EditIndex = e.NewEditIndex
        GridView2.DataSourse = DataSet1
        GridView2.DataBind()
End Sub
I've solved the first problem but so now it recognize the Edit Command but after that it wont see the other buttons command such as update or cancel .. i solved the first problem by binding the grid to the data at load instead of a button click but now i need to bind at RowEditing level what would be the problem Note : Only one grid has to be shown at a time
Posted 3-Oct-12 21:07pm by ayat abukhadra.
Tags:


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 5 Nov 2009
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid