Hi,
I would like to add a text and image to my link button. I want to show text on left and image on the right side of the button.
Here is the code that i wrote:
LinkButton mybutton = new LinkButton();
mybutton.Text = "Hindhi";
mybutton.Controls.Add(new ImageButton()
{
ImageUrl = @"c:\APPthemes\img\india.gif"
});
Many thanks,
Darma
Add text and image to link button
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Javeed M ShaikhRank #839 · 2.7K reputationPosted Apr 24, 2013, 8:14 AM EDT
LinkButton mybutton = new LinkButton();
mybutton.Controls.Add(new ImageButton()
{
ImageUrl = @"c:\APPthemes\img\india.gif"
});
Label mylabel = new Label();
mylabel.Text = "Sample text";
p1.Controls.Add(mybutton);
p1.Controls.Add(mylabel);
I have added the below line in my aspx:
darma tejaRank #3,199 · 449 reputationPosted Apr 24, 2013, 12:04 PM EDT
One more thing I want to say if I use hard code path for my image, the image is not showing in the browser.
When I use "~\img\india.gif", It is showing in the browser.
Darma
Javeed M ShaikhRank #839 · 2.7K reputationPosted Apr 24, 2013, 12:53 PM EDT