Hi All
I am creating a Datagrid on the fly, which works fine, added a edit,cancel update command field as a template field.
However wen I click on Update
nothin happens, currently it isn't connected to the database I just want it to change the text of a button so I know the update works. All was workin fine b4 I added the UpdatePanel and Content Template. The ScriptManager is in the Master Page
Please help me....Thank u....
Please see below:-
Masterpage.aspx
HTML Code:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
UpdateAttendance.aspx
Code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None" onrowupdating="GridView1_RowUpdating"
onrowediting="GridView1_RowEditing"
onrowdatabound="GridView1_RowDataBound"
onselectedindexchanged="GridView1_SelectedIndexChanged"
onrowcommand="GridView1_RowCommand"
onrowcancelingedit="GridView1_RowCancelingEdit"
oninit="GridView1_Init">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
CommandName="Update" Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
CommandName="Edit" onclick="LinkButton1_Click1" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</ContentTemplate></asp:UpdatePanel>
RowUpdating
Code:
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow gvrow = GridView1.Rows[e.RowIndex]; TextBox txt_eventId = (TextBox)gvrow.Cells[1].Controls[0]; CheckBox chk_SelectCheckbox = (CheckBox)gvrow.Cells[4].Controls[0]; //checkbox to capture chkbox selection Button1.Text = "DDDDDDDDDDDDDDDD"; }