Hi all
I have gridview inside update panel. I used template field inside gridview.but when i changed the page...update panel stops working and entire page get refereshed..i want to be refresh only gridview.......
Any ideas........plz
thank u
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Prabhu RajaRank #861 · 2.6K reputationPosted Oct 4, 2011, 10:42 PM EDT
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack)
{
// Your Taks on when Page gets Loaded.
}
}
sonal thosar17 reputationPosted Oct 4, 2011, 11:04 PM EDT
Prabhu RajaRank #861 · 2.6K reputationPosted Oct 4, 2011, 11:31 PM EDT
sonal thosar17 reputationPosted Oct 4, 2011, 11:46 PM EDT
onpageindexchanging="GridView1_PageIndexChanging"
onrowdatabound="GridView1_RowDataBound" AllowSorting="True" OnPreRender="GridView1_PreRender"
BorderStyle="None">
<%#Eval("CoName") %>-
======================Code behind=================================
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
GridView1.PageIndex = 0;
object[] param = new object[2];
param[0] = "HomePageAnnouncement";
param[1] = DBNull.Value;
GridView1.DataSource = objHandler.ExecuteProcedureRtnDT("RB_CompanyAnnouncement", param);
GridView1.DataBind();
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
lstComAnn();
UPCompanyAnnonce.Update();
}
private string prevEventDateAnnouncement1 = "00 xxx 0000";
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string AnnouncementDate = string.Empty;
AnnouncementDate = Convert.ToDateTime(GridView1.DataKeys[e.Row.RowIndex].Value).ToString("dd MMM yyyy");
if (!prevEventDateAnnouncement1.Equals(AnnouncementDate, StringComparison.CurrentCultureIgnoreCase))
{
HtmlTableRow trDate = (HtmlTableRow)e.Row.FindControl("trDate");
HtmlTableCell htc = new HtmlTableCell();
htc.ColSpan = 2;
htc.Attributes.Add("class", "date-hd");
htc.InnerHtml = "" + AnnouncementDate + "";
trDate.Controls.Add((HtmlTableCell)htc);
trDate.Visible = true;
prevEventDateAnnouncement1 = AnnouncementDate;
}
HiddenField hdNamenDesignation = (HiddenField)e.Row.FindControl("hdnNamenDesignation");
HiddenField hdDescription = (HiddenField)e.Row.FindControl("hdnDescription");
Label lblNamenDesignation = (Label)e.Row.FindControl("lblNamenDesignation");
Label lblCompanyAnn = (Label)e.Row.FindControl("lblCompanyAnn");
if (!string.IsNullOrEmpty(hdNamenDesignation.Value))
{
lblNamenDesignation.Text = hdNamenDesignation.Value;
lblCompanyAnn.Attributes.Add("onmouseover", "javascript:tooltip.show('" + hdDescription.Value.Replace("'", "") + "');");
lblCompanyAnn.Attributes.Add("onmouseout", "javascript:tooltip.hide();");
}
else
{
if (hdDescription.Value.Length > 31)
{
lblNamenDesignation.Text = hdDescription.Value.Substring(0, 30) + "...";
lblCompanyAnn.Attributes.Add("onmouseover", "javascript:tooltip.show('" + hdDescription.Value.Replace("'", "") + "');");
lblCompanyAnn.Attributes.Add("onmouseout", "javascript:tooltip.hide();");
}
}
}
}
Suthish NairRank #92 · 22.8K reputationPosted Oct 5, 2011, 9:11 AM EDT
sonal thosar17 reputationPosted Oct 6, 2011, 9:05 PM EDT