Hi!
I'll get right to the point. I'm having problems with the ToolTip Manager. I have a RadGrid and to every label in one of the rows of the grid I add a tooltip (which loads on demand). What happens is I move the cursor over a label and the tooltip shows as expected. I click on whatever button on my page which generates a postback. Once again I move the cursor over a tooltip which again opens with no problem...and then.. my problem starts. In the next step if I click on whatever button or move the cursor over another label in order to show the tooltip, I get the following asp.net error:
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. (...)
here is the code of the relevant methods:
protected void Page_Load(object sender, EventArgs e) |
{ |
(...) |
RadToolTipManager1.TargetControls.Clear(); |
if (!IsPostBack) |
{ |
LoadData(Convert.ToString(ViewState["type"]), !IsPostBack); |
} |
(...) |
} |
private void LoadData(string type, bool withBind) |
{ |
gridObjects.DataSource = mmObject.getDTObjectList(xxx, yyy); |
if (withBind) |
{ |
gridObjects.DataBind(); |
} |
} |
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args) |
{ |
string value = Convert.ToString(args.Value); |
this.UpdateToolTip(value, args.UpdatePanel); |
} |
private void UpdateToolTip(string filename, UpdatePanel panel) |
{ |
Control ctrl = Page.LoadControl("~/controls/Community/ComDisplayImage.ascx"); |
panel.ContentTemplateContainer.Controls.Add(ctrl); |
panel.Visible = true; |
ComDisplayImage options = (ComDisplayImage)ctrl; |
options.Filename = filename; |
} |
protected void gridObjects_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
DataRowView row = (DataRowView)e.Item.DataItem; |
string text = row["file_path"].ToString(); |
System.Web.UI.WebControls.Label label = (System.Web.UI.WebControls.Label)e.Item.FindControl("lblTitleItem"); |
RadToolTipManager1.TargetControls.Add(label.ClientID, text, true); |
} |
} |