urgent !!!! button in gridview in update panel causing issue [Resolved]

Posted by Vijayaparichit under ASP.NET on 4/13/2012 | Points: 10 | Views : 3298 | Status : [Member] | Replies : 5
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




Responses

Posted by: Rajni.Shekhar on: 4/13/2012 [Member] Bronze | Points: 50

Up
0
Down

Resolved
keep lbltest label in update panel.

<asp:UpdatePanel runat="server" ID="updlabel" UpdateMode="Always"> 

<ContentTemplate>
<asp:label id="lbltest" text="" runat="server"/>
</ContentTemplate>
</asp:UpdatePanel>





Thanks,
Rajni Shekhar

Vijayaparichit, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

Where u got error tell me clearly?

Thanks & Regards
Hari

Vijayaparichit, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vijayaparichit on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Hi hari,

I didnot get any error but in gridview if i click the button then the message was not displayed.

Vijayaparichit, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dylanrodriguez on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Hello Guys.

I am sharepoint developers from india.

All your comment for sharepoint development ans all technology development are welcome.

Thanks in advance.


http://www.aegisisc.com/sharepoint-developers.html

Vijayaparichit, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vijayaparichit on: 4/16/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Rajni,

U r really Rajni for me....

Vijayaparichit, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response