This is a migrated thread and some comments may be shown as answers.

ToolTip related? - Invalid postback...

1 Answer 89 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Krzysztof
Top achievements
Rank 2
Krzysztof asked on 06 Oct 2008, 11:49 AM

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); 
        } 
    } 
 
 
 
 

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 09 Oct 2008, 07:13 AM

Hi Krzysztof,

This error is not directly related to RadControls but to your custom code and general ASP.NET knowledge.This error occurs when the layout of the form being submitted differs from what has been defined on the server side and you have validation enabled. This is usually caused by adding new fields, or items to forms using client
script, or the end user submits the form before the page has finished rendering because the server needs the following line

<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="somestringofgiberish"

to be correctly rendered before submitting the form. It is a feature to stop people submitting their own forms to your ASP.net page. What I can suggest is to set the enableEventValidation property to false either in the page directive or in the Web.config. This should fix the problem but I also recommend to search the net for other possible solutions.


Sincerely yours,

Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ToolTip
Asked by
Krzysztof
Top achievements
Rank 2
Answers by
Svetlina Anati
Telerik team
Share this question
or