Hi all,
I have a button in gridview, gridview is in updatepanel, when i click button i am unable to show the message in a label.
I tried with javascript alert also which is not working.
<asp:UpdatePanel runat="server" ID="updGrid" UpdateMode="Always">
<Triggers>
<asp:PostBackTrigger ControlID="btnNotInGrid" />/*this button works as its not in grid */
</Triggers>
<ContentTemplate>
<asp:GridView ID="GridView1" Width="100%" runat="server" DataKeyNames="ID" AutoGenerateColumns="false"
AllowSorting="True" CssClass="GridViewStyle" ShowHeader="false" GridLines="None"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label ID="lblID" Text='<%#Eval("ID")%>' runat="server"></asp:Label>
<%--<%#Eval("ID")%>--%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Save" HeaderStyle-Width="50">
<ItemTemplate>
<asp:Button ID="btnSaveSingle" runat="server" CommandName="SAVE" Text="Save" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "SAVE")
{
GridViewRow grow = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
Label lblID = (Label)grow.FindControl("lblID");
TextBox txtDOS = (TextBox)grow.FindControl("txtDOS");
TextBox txtcmt = (TextBox)grow.FindControl("txtComment");
DropDownList ddl = (DropDownList)grow.FindControl("ddlCharttype");
SaveRecord(Convert.ToInt32(lblID.Text), ddl.SelectedValue, txtDOS.Text, txtcmt.Text);
lbltest.Text = "Your changes have been saved.";
//string scriptstring="<script language=javascript>" + "alert('Changes saved'); </script>";
//ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", scriptstring);
//ScriptManager.RegisterStartupScript(this, this.GetType(), "alertscript",scriptstring,true);
//Message("hi");
}
Need a solution , its very urgent.
Thanks in adavance
Vijay