locked
LinkButton RRS feed

  • Question

  • User-1499457942 posted

    Hi

      In below LinkButton i want to add image on which it should be written Details

    <itemtemplate>
                                <asp:linkbutton id="btnDetails" Text="Incentive History" tooltip="Details" CommandName="Details" runat="server" /> 
                            </itemtemplate>

    Thanks

    Tuesday, November 27, 2018 2:16 PM

Answers

  • User-893317190 posted

    Hi JagjitSingh,

    You could use <asp:imagebutton runat="server"></asp:imagebutton> to show image.

    If you  want to get an image with string on it , you could refer to the code below.

                Bitmap map = new Bitmap(80, 50); //generate an image in memory
                
                using (Graphics g = Graphics.FromImage(map)) 
                {
                    g.Clear(Color.White);      //draw background
                    g.DrawImage(map, 0, 0, 80, 50);
                    using (Font f = new Font("Times New Roman", 20))
                    {
                        using (Brush b = new SolidBrush(Color.DarkBlue)) //generate a brush
                        {
                            string addText = "detail";
                            g.DrawString(addText, f, b, 0, 0);  //draw string on the image
                        }
                    }
                }
                string fontpath = Server.MapPath(@"/FileDemo/FontMark.bmp");
                map.Save(fontpath, System.Drawing.Imaging.ImageFormat.Bmp); // save the image
                //this.image_Font.ImageUrl = @"~/image/FontMark.bmp";

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 28, 2018 2:28 AM