Tooltip manager : repeater item command not raised

2 posts, 0 answers
  1. jocelyn payneau
    jocelyn payneau avatar
    2 posts
    Member since:
    Dec 2009

    Posted 07 Sep 2010 Link to this post

    Hello,

    I have a bug with tooltip manager.

    When it has some target controls defined, my item command event is not raised.

    Here is a part of my ascx file :
    <div id="Div2" class="field" runat="server">
        <label>
            <asp:Literal ID="lblText1" runat="server"></asp:Literal><uc1:RequiredFieldSign ID="ReqFieldSign1"
                runat="server" />
        </label>
        <asp:Repeater runat="server" ID="rptFiles" OnItemCommand="rptFiles_ItemCommand" OnItemDataBound="rptFiles_DataBound" OnItemCreated="rptFiles_ItemCreated">
            <HeaderTemplate><ul class="filelist"></HeaderTemplate>
            <ItemTemplate>
                <li>
                <a id="apercuimg" runat="server" class="lien" href='<%# DataBinder.Eval(Container.DataItem, "lienclick")%>' target="_blank"><%# DataBinder.Eval(Container.DataItem, "FileName")%></a>
                <span class="RemoveLink" style="padding-left: 30px">
                    <asp:LinkButton ID="RemoveImage" Text="Supprimer cet élément" runat="server" OnClick="RemoveImage_Click"
                        CommandName="DeleteImage" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ImageId")%>' CausesValidation="false">
                    </asp:LinkButton>
                </span>
                </li>
            </ItemTemplate>
            <FooterTemplate></ul><br /></FooterTemplate>
        </asp:Repeater>
    </div>
    <telerik:RadToolTipManager runat="server" AnimationDuration="300" ShowDelay="200"
        EnableShadow="true" HideDelay="1" ID="ttmUpload3" Width="10px" Height="10px"
        RelativeTo="Element" Animation="Resize" Position="TopRight" OnAjaxUpdate="OnAjaxUpdate"
      
        Skin="Windows7" />

    and here itemcommand event and item created event :

    protected

     

    void rptFiles_ItemCommand(object sender, RepeaterCommandEventArgs e)

     

    {

     

    string connString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();

     

     

    if (e.CommandName == "DeleteImage")

     

    {

     

    if (TableId != 1)

     

    {

     

    string sql = "DELETE FROM Images WHERE ImageId=@ImageId";

     

     

    SqlParameter param = new SqlParameter("@ImageId", e.CommandArgument);

     

     

    SqlHelper.ExecuteNonQuery(connString, CommandType.Text, sql, param);

     

     

    this._dtFiles.Rows.RemoveAt(e.Item.ItemIndex);

     

    }

     

    else

     

    {

     

    string sql = string.Format("UPDATE {0} SET {1}=@ImageValue WHERE {1}=@Filename", TableName, FieldName);

     

     

    SqlParameter param = new SqlParameter("@ImageValue", DBNull.Value);

     

     

    SqlParameter param1 = new SqlParameter("@Filename", ImagePath);

     

     

    SqlHelper.ExecuteNonQuery(connString, CommandType.Text, sql, param, param1);

     

     

    this._dtFiles.Rows.RemoveAt(e.Item.ItemIndex);

     

    }

     

    this._dtFiles.Columns.Add("lienclic");

     

     

    this.rptFiles.DataSource = this._dtFiles;

     

     

    this.rptFiles.DataBind();

     

     

    if (rptFiles.Items.Count == 0)

     

    {

    Div2.Style.Add(

    "display", "none");

     

    Div1.Style.Add(

    "display", "");

     

    }

    }

    }



    protected
    void rptFiles_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                DataRowView drv = (DataRowView)e.Item.DataItem;
      
                Control apercuimg = e.Item.FindControl("apercuimg");
      
                if (drv != null)
                {
                    apercuimg.ID = "apercuimg_" + drv["ImageId"].ToString();
      
                    if (drv["FileName"] != null && drv["FileName"].ToString() != "")
                    {
                        if (drv["FileName"].ToString().ToLower().Contains(".jpg") || drv["FileName"].ToString().ToLower().Contains(".jpeg") || drv["FileName"].ToString().ToLower().Contains(".gif") || drv["FileName"].ToString().ToLower().Contains(".png") || drv["FileName"].ToString().ToLower().Contains(".tif"))
                        {
                            if (apercuimg != null && drv["ImagePath"] != null)
                            {
                                if (drv["FileName"].ToString() != drv["ImagePath"].ToString())
                                {
                                    this.ttmUpload3.TargetControls.Add(apercuimg.ClientID, drv["ImagePath"].ToString(), true);
                                }
                                else
                                {
                                    this.ttmUpload3.TargetControls.Add(apercuimg.ClientID, this.ViewPath + drv["ImagePath"].ToString(), true);
                                }
                            }
                        }
                        else
                        {
                            drv["lienclick"] = drv["ImagePath"].ToString();
                        }
                    }
      
                    LinkButton lnk = (LinkButton)e.Item.FindControl("RemoveImage");
                    if (lnk != null)
                    {
                        lnk.ID = "rmvImage_" + drv["ImageId"].ToString();
      
                        lnk.OnClientClick = "if(confirm('Etes vous sûr de vouloir supprimer cette image?')) {setCookie('deleteimage'," + drv["ImageId"].ToString() + ", 1); return true; }";
                    }
                }
            }
        }

    Thanks for your help
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 09 Sep 2010 Link to this post

    Hi jocelyn payneau,

     
    We are not aware of such an issue and basically the tooltip manager should not impact the events of the tooltipified controls. However, I see from your code that you have a user control on the page (RequiredFieldSign) which I assume that might be causing the issue. In case it is a validation control, your button will not submit the page if the validation does not pass. What I can suggest is to test the following:

    1) Remove the user control and test again to see whether this fixes the problem. If so, revise your logic accordingly.

    2) If 1) did not make a difference, leave the page as it is but remove the tooltip manager completely from your code and test again. If the problem still exists, resolve it by using this standard setup and after that simply add back the tooltip manager and everything should work correctly.

    If the problem disappears when you remove the manager and you do not change anything else and the issue occurs back when you add the manager, please share some fully runnable code here (use a fake programmatic datasource for the repeater) which has everything correctly working without using tooltip manager along with explanations of the desired target control and I will tooltipify it for you with the current functionality before the tooltipifying kept working in the same manner.


    Greetings,

    Svetlina
    the Telerik team

     

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top