protected virtual void OnServerClick(ImageClickEventArgs e)
        {
            ImageClickEventHandler handler = (ImageClickEventHandler)base.Events[EventServerClick];

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemple #2
0
        protected virtual void OnServerClick(ImageClickEventArgs e)
        {
            ImageClickEventHandler handler = Events [ServerClickEvent] as ImageClickEventHandler;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        /// <include file='doc\ImageButton.uex' path='docs/doc[@for="ImageButton.OnClick"]/*' />
        /// <devdoc>
        /// <para>Raises the <see langword='Click'/> event.</para>
        /// </devdoc>
        protected virtual void OnClick(ImageClickEventArgs e)
        {
            ImageClickEventHandler onClickHandler = (ImageClickEventHandler)Events[EventClick];

            if (onClickHandler != null)
            {
                onClickHandler(this, e);
            }
        }
Exemple #4
0
    /// <summary>
    /// generates an image button
    /// </summary>
    /// <param name="path"></param>
    /// <param name="clickEvent"></param>
    /// <param name="id"></param>
    /// <returns></returns>
    private ImageButton GenerateImgButton(string path, ImageClickEventHandler clickEvent, string id)
    {
        ImageButton btn = new ImageButton();

        btn.CssClass = "delete-btn-admin";
        btn.ImageUrl = path;
        btn.ID       = id;
        btn.Click   += clickEvent;
        return(btn);
    }
Exemple #5
0
 protected virtual void OnClick(ImageClickEventArgs e)
 {
     if (Events != null)
     {
         ImageClickEventHandler eh = (ImageClickEventHandler)(Events [ClickEvent]);
         if (eh != null)
         {
             eh(this, e);
         }
     }
 }
        protected virtual void OnClick(ImageClickEventArgs e)
        {
            ImageClickEventHandler handler = (ImageClickEventHandler)base.Events[EventClick];

            if (handler != null)
            {
                handler(this, e);
            }
            EventHandler handler2 = (EventHandler)base.Events[EventButtonClick];

            if (handler2 != null)
            {
                handler2(this, e);
            }
        }
    public static ImageButton ImgBtnDyn(this Control control, string id, string imgUrl, ImageClickEventHandler handler, string style = "")
    {
        ImageButton imgBtn = new ImageButton();

        imgBtn.ID       = id;
        imgBtn.ImageUrl = imgUrl;
        imgBtn.Click   += handler;
        imgBtn.CssClass = style;

        control.Controls.Add(imgBtn);

        return(imgBtn);
    }
 public void AddSaveHandler(ImageClickEventHandler handler)
 {
     btnSave.Click += handler;
 }
 public static void SetGridViewSortImages(object sender, GridViewRowEventArgs e, string sortExpression, string sortDirection, ImageClickEventHandler ascClickEventHandler, ImageClickEventHandler descClickEventHandler, string ascImageFilePath, string descImageFilePage, string headerCellCssClass, string headerSortImagesLayoutCSSClass, string headerTextCSSClass)
 {
     SetGridViewSortImages(sender, e, sortExpression, sortDirection, ascClickEventHandler, descClickEventHandler, ascImageFilePath, descImageFilePage, headerTextCSSClass);
 }
        public static void SetGridViewSortImages(object sender, GridViewRowEventArgs e, string sortExpression, string sortDirection, ImageClickEventHandler ascClickEventHandler, ImageClickEventHandler descClickEventHandler, string ascImageFilePath, string descImageFilePage, string headerTextCssClass)
        {
            if (e.Row != null && e.Row.RowType == DataControlRowType.Header)
            {
                int i = 0;
                foreach (TableCell tc in e.Row.Cells)
                {
                    if (tc.HasControls() || (tc.Text != string.Empty && tc.Text.Trim() != "&nbsp;"))
                    {
                        Table table = new Table(), imageTable = new Table();
                        table.CellPadding = 0;
                        table.CellSpacing = 0;
                        table.Style.Add(HtmlTextWriterStyle.VerticalAlign, "middle");
                        table.Attributes.Add("summary", "Header cell structual table");
                        imageTable.CellSpacing = 0;
                        imageTable.CellPadding = 0;
                        imageTable.Attributes.Add("summary", "Sort images structual table");
                        table.BorderStyle = BorderStyle.None;
                        imageTable.BorderStyle = BorderStyle.None;
                        TableRow row = null, AscImageRow, DescImageRow;
                        TableCell AscImageCell, DescImageCell, headerTextCell, imagesCell;

                        AscImageRow = new TableRow();
                        AscImageRow.BackColor = Color.Transparent;
                        AscImageCell = new TableCell();
                        AscImageCell.BorderWidth = new Unit(0);
                        AscImageCell.Style.Add(HtmlTextWriterStyle.Padding, "0");
                        AscImageCell.Style.Add(HtmlTextWriterStyle.Margin, "0");
                        AscImageRow.Cells.Add(AscImageCell);

                        DescImageRow = new TableRow();
                        DescImageRow.BackColor = Color.Transparent;
                        DescImageCell = new TableCell();
                        DescImageCell.BorderWidth = new Unit(0);
                        DescImageCell.Style.Add(HtmlTextWriterStyle.Padding, "0");
                        DescImageCell.Style.Add(HtmlTextWriterStyle.Margin, "0");
                        DescImageRow.Cells.Add(DescImageCell);

                        imagesCell = new TableCell();
                        imagesCell.Width = new Unit(1);
                        imagesCell.BorderWidth = new Unit(0);
                        imagesCell.Style.Add(HtmlTextWriterStyle.Padding, "0");
                        imagesCell.Style.Add(HtmlTextWriterStyle.Margin, "0");
                        imagesCell.Controls.Add(imageTable);

                        row = new TableRow();
                        row.BackColor = Color.Transparent;

                        headerTextCell = new TableCell();
                        headerTextCell.BorderWidth = new Unit(0);
                        headerTextCell.Style.Add(HtmlTextWriterStyle.Padding, "0");
                        headerTextCell.Style.Add(HtmlTextWriterStyle.Margin, "0");
                        headerTextCell.HorizontalAlign = HorizontalAlign.Left;
                        Label HeaderLabel = new Label();
                        HeaderLabel.CssClass = headerTextCssClass;
                        headerTextCell.Controls.Add(HeaderLabel);

                        if (tc.HasControls())
                        {
                            // search for the header link
                            LinkButton lnk = tc.Controls[0] as LinkButton;
                            if (lnk != null)
                            {
                                ImageButton imgBtnUp = new ImageButton();
                                ImageButton imgBtnDown = new ImageButton();
                                imgBtnUp.ID = "imgAsc" + i.ToString();
                                imgBtnDown.ID = "imgDesc" + i.ToString();
                                i++;
                                imgBtnUp.Click += new ImageClickEventHandler(ascClickEventHandler);
                                imgBtnDown.Click += new ImageClickEventHandler(descClickEventHandler);
                                imgBtnUp.CommandName = lnk.CommandName;
                                imgBtnDown.CommandName = lnk.CommandName;
                                imgBtnUp.CommandArgument = lnk.CommandArgument;
                                imgBtnDown.CommandArgument = lnk.CommandArgument;

                                //--set the properties
                                HeaderLabel.Text = lnk.Text.Trim();

                                imgBtnUp.ImageUrl = ascImageFilePath;
                                imgBtnUp.AlternateText = "ascending";
                                imgBtnDown.ImageUrl = descImageFilePage;
                                imgBtnDown.AlternateText = "descending";

                                //// checking if the header link is the user's choice
                                if (sortExpression != lnk.CommandArgument || sortDirection == "DESC")
                                {
                                    AscImageCell.Controls.Add(imgBtnUp);
                                    imageTable.Rows.Add(AscImageRow);
                                }
                                if (sortExpression != lnk.CommandArgument || sortDirection == "ASC")
                                {
                                    DescImageCell.Controls.Add(imgBtnDown);
                                    imageTable.Rows.Add(DescImageRow);
                                }

                                //--this will remove the clickable column header link button that is automatically created
                                //--when adding sorting capabilities to a gridview
                                tc.Controls.RemoveAt(0);

                                if (!AscImageCell.HasControls())
                                {
                                    AscImageCell.Dispose();
                                    AscImageRow.Dispose();
                                }
                                if (!DescImageCell.HasControls())
                                {
                                    DescImageCell.Dispose();
                                    DescImageRow.Dispose();
                                }
                                row.Cells.Add(imagesCell);
                                row.Cells.Add(headerTextCell);
                                table.Rows.Add(row);
                                tc.Style.Add(HtmlTextWriterStyle.VerticalAlign, "middle");
                                tc.Controls.Add(table);
                            }
                        }
                        else
                        {
                            imagesCell.Dispose();
                            HeaderLabel.Text = tc.Text;
                            headerTextCell.VerticalAlign = VerticalAlign.Middle;
                            row.Cells.Add(headerTextCell);
                            table.Rows.Add(row);
                            tc.Style.Add(HtmlTextWriterStyle.VerticalAlign, "middle");
                            tc.Controls.Add(table);
                        }
                    }
                }
            }
        }
Exemple #11
0
 public ChildTemplate(ListItemType type, ImageClickEventHandler imgClicked)
 {
     _templateType      = type;
     ChildImage_Clicked = imgClicked;
 }
Exemple #12
0
        protected override void CreateChildControls()
        {
            FPreviewControl.AsyncExecution = AsyncExecution;
            FPreviewControl.AsyncPriority  = AsyncPriority;
            LiteralControl lt;

            lt = new LiteralControl("<table border=\"1\">\n");
            Controls.Add(lt);

            lt = new LiteralControl("<tr>\n");
            Controls.Add(lt);

            lt = new LiteralControl("<td>\n");
            Controls.Add(lt);

            {
                {
                    ImageClickEventHandler clickevent =
                        new ImageClickEventHandler(Image_Click);

                    lt = new LiteralControl("<table>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<tr>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);
                    // First
                    BFirst = new System.Web.UI.WebControls.ImageButton();
                    BFirst.EnableViewState = false;
                    BFirst.ImageUrl        = Page.ClientScript.GetWebResourceUrl(this.GetType(),
                                                                                 "Reportman.Web.first.bmp");
                    BFirst.AlternateText = Translator.TranslateStr(221);
                    BFirst.Click        += clickevent;
                    Controls.Add(BFirst);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Previous
                    BPrevious = new System.Web.UI.WebControls.ImageButton();
                    BPrevious.EnableViewState = false;
                    BPrevious.ImageUrl        = Page.ClientScript.
                                                GetWebResourceUrl(this.GetType(),
                                                                  "Reportman.Web.previous.bmp");
                    BPrevious.AlternateText = Translator.TranslateStr(223);
                    BPrevious.Click        += clickevent;
                    Controls.Add(BPrevious);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);


                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Next
                    BNext = new System.Web.UI.WebControls.ImageButton();
                    BNext.EnableViewState = false;
                    BNext.ImageUrl        = Page.ClientScript.GetWebResourceUrl(this.GetType(),
                                                                                "Reportman.Web.next.bmp");
                    BNext.AlternateText = Translator.TranslateStr(225);
                    BNext.Click        += clickevent;
                    Controls.Add(BNext);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Last
                    BLast = new System.Web.UI.WebControls.ImageButton();
                    BLast.EnableViewState = false;
                    BLast.ImageUrl        = Page.ClientScript.GetWebResourceUrl(this.GetType(),
                                                                                "Reportman.Web.last.bmp");
                    BLast.AlternateText = Translator.TranslateStr(227);
                    BLast.Click        += clickevent;
                    Controls.Add(BLast);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Escale real
                    BScale1 = new System.Web.UI.WebControls.ImageButton();
                    BScale1.EnableViewState = false;
                    BScale1.ImageUrl        = Page.ClientScript.GetWebResourceUrl(this.GetType(),
                                                                                  "Reportman.Web.scale1.bmp");
                    BScale1.AlternateText = Translator.TranslateStr(229);
                    BScale1.Click        += clickevent;
                    Controls.Add(BScale1);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Print
                    BPrint = new System.Web.UI.WebControls.ImageButton();
                    BPrint.EnableViewState = false;
                    BPrint.ImageUrl        = Page.ClientScript.GetWebResourceUrl(this.GetType(),
                                                                                 "Reportman.Web.print.bmp");
                    BPrint.AlternateText = Translator.TranslateStr(53);
                    BPrint.Click        += clickevent;
                    Controls.Add(BPrint);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Zoom Minus
                    BZoomMinus = new System.Web.UI.WebControls.ImageButton();
                    BZoomMinus.EnableViewState = false;
                    BZoomMinus.ImageUrl        = Page.ClientScript.GetWebResourceUrl(
                        this.GetType(), "Reportman.Web.zoom1.bmp");
                    BZoomMinus.AlternateText = Translator.TranslateStr(235);
                    BZoomMinus.Click        += clickevent;
                    Controls.Add(BZoomMinus);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Zoom Plus
                    BZoomPlus = new System.Web.UI.WebControls.ImageButton();
                    BZoomPlus.EnableViewState = false;
                    BZoomPlus.ImageUrl        = Page.ClientScript.GetWebResourceUrl(
                        this.GetType(), "Reportman.Web.zoom2.bmp");
                    BZoomPlus.AlternateText = Translator.TranslateStr(237);
                    BZoomPlus.Click        += clickevent;
                    Controls.Add(BZoomPlus);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // ComboBox Image Format
                    BFormat = new System.Web.UI.WebControls.DropDownList();
                    BFormat.AutoPostBack = true;
                    Strings codecs = GraphicUtils.GetImageCodecs();
                    BFormat.Items.Clear();
                    foreach (string s in codecs)
                    {
                        BFormat.Items.Add(new ListItem(s));
                    }
                    BFormat.SelectedIndex = BFormat.Items.IndexOf(new ListItem(PreviewControl.Format));
                    //					BFormat.AlternateText = Translator.TranslateStr(237);
                    EventHandler clickeventformat = new EventHandler(Format_Click);
                    BFormat.SelectedIndexChanged += clickeventformat;
                    Controls.Add(BFormat);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);


                    lt = new LiteralControl("<td>" +
                                            HttpUtility.HtmlEncode(Translator.TranslateStr(269)) + "</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);
                    // Go to page
                    EPage           = new System.Web.UI.WebControls.TextBox();
                    EPage.Text      = "";
                    EPage.MaxLength = 6;
                    EPage.Width     = 50;
                    Controls.Add(EPage);
                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Update page
                    BPage = new System.Web.UI.WebControls.ImageButton();
                    BPage.EnableViewState = false;
                    BPage.ImageUrl        = Page.ClientScript.GetWebResourceUrl(
                        this.GetType(), "Reportman.Web.update.bmp");
                    BPage.AlternateText = Translator.TranslateStr(1149);
                    BPage.Click        += clickevent;
                    Controls.Add(BPage);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("<td>\n");
                    Controls.Add(lt);

                    // Label total pages
                    LTotalPages = new System.Web.UI.WebControls.Label();
                    Controls.Add(LTotalPages);

                    lt = new LiteralControl("</td>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("</tr>\n");
                    Controls.Add(lt);

                    lt = new LiteralControl("</table>\n");
                    Controls.Add(lt);
                }
            }
            lt = new LiteralControl("</td>\n");
            Controls.Add(lt);

            lt = new LiteralControl("</tr>\n");
            Controls.Add(lt);

            lt = new LiteralControl("<tr>\n");
            Controls.Add(lt);

            lt = new LiteralControl("<td>\n");
            Controls.Add(lt);

            Controls.Add(FPreviewControl);

            lt = new LiteralControl("</td>\n");
            Controls.Add(lt);

            lt = new LiteralControl("</tr>\n");
            Controls.Add(lt);

            lt = new LiteralControl("</table>\n");
            Controls.Add(lt);

            base.CreateChildControls();
            ChildControlsCreated = true;
        }