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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
sonal thosarPosted Oct 7, 2011, 1:05 AM
Suthish NairPosted Oct 5, 2011, 1:11 PM
sonal thosarPosted Oct 5, 2011, 3:46 AM
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();");
}
}
}
}
Prabhu RajaPosted Oct 5, 2011, 3:31 AM
sonal thosarPosted Oct 5, 2011, 3:04 AM
Prabhu RajaPosted Oct 5, 2011, 2:42 AM
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack)
{
// Your Taks on when Page gets Loaded.
}
}