0

I've tried to use LinkButton to add "Previous" "Home" and "Next" to my webpage and once I clicked on the link, it works properly on what it does, but it changed my website's layout, take out all the available menu items on my webpage's top and left panel.

I tried to run it without assigning an event handler to the LinkButton. When clicking on the link, my content layout doesn't change a thing, but the top and left panel changed. Weird right?

Anyone facing similar problem?

previous = new LinkButton();
next = new LinkButton();
home = new LinkButton();

previous.Text = "Previous";
previous.Click += Show_Previous;

next.Text = "Next";
next.Click += Show_Next;

home.Text = "Home";
home.Click += Show_Home;
James Johnson
  • 45,496
  • 8
  • 73
  • 110
Desmond.Tan
  • 53
  • 1
  • 3
  • What is the content of the Show_Previous, Show_Next and Show_Home methods? – Fiona - myaccessible.website May 04 '12 at 10:07
  • I am developing a Photo Gallery web content, each Item is a ImageButton, I've fixed one page to have 20 ImageButtons. When "next"/"previous" is clicked, it will retrieve data from database and assigned it into those ImageButtons instances. It works as I design, just that it changes other things too. – Desmond.Tan May 04 '12 at 10:18

2 Answers2

0

if those link buttons are in your masterpage , in your masterpage_load event you should clear those link buttons if page ISPOSTBACK and then you should create new link buttons ! the reason that your page layout changes is that you get new linkbutton elements again and again I think !

and if those buttons are in a simple page or a content page create your linkbuttons if page is not postback and on each postback reassign the click values !

gwt
  • 2,331
  • 4
  • 37
  • 59
0

Solved it by changing LinkButton to Button. (Fast solution)

I dont get it, It works well with ImageButton and Button. But when comes to LinkButton it changes my layouts.

Just for curiosity, anything else that works the same as LinkButton? Can Hyperlink do the trick?

I've saw some website using c# asp to do exactly what i'm doing. But without having the "Next"/"Previous" link text calling javascript's "_doPostBack" function. Any Idea?

Desmond.Tan
  • 53
  • 1
  • 3