Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LinkButton Event Not Firing

Status
Not open for further replies.

Gorkem

Programmer
Jun 18, 2002
259
CA
Hello,

I have a page that contains a DataList and several nested Repeaters and an XMLDataSource. Outside of the nested Repeaters, I have a linkbutton associated with the DataList with a CommandName and CommandArgument.

The problem is, when I click on the linkbutton, the first event to fire is the DataList_OnItemCreated and the linkbutton event(Link_OnCommand) or the DataList event (DataList_Command) never triggers.

The page also has a MasterPageFile.

My Linkbutton code is:

Code:
<asp:LinkButton runat=server OnCommand="Link_OnCommand" CommandName="ShowMoreTimes" CommandArgument='<%# Eval("AvailFareID") %>' ID="MoreTimes" Text="More Times"></asp:LinkButton>

The basic layout of the page is:

Code:
<DATALIST>
     <ITEMTEMPATE>
          [b] <LINKBUTTON> [/b] <-- ** Event doesn't fire
          <XMLDATASOURCE>
          <REPEATER>
              <ITEMTEMPLATE>
                   <REPEATER>
                      <ITEMTEMPLATE>.....</ITEMTEMPLATE>
                   </REPEATER>
              </ITEMTEMPLATE>
          </REPEATER>
     </ITEMTEMPLATE>
</DATALIST>

If anyone can shed some light on this, I would be greatful!

Cheers,

G.



Oxigen - Next generation business solutions
-----------------------------
Components/Tools/Forums/Software/Web Services
 
UPDATE...

Ok.. so I've commented out most of the code to leave myself with JUST the one datalist (the main one). When I click on the linkbutton, it still fires the DataList_ItemCreated event first...

Here is the list of events that is fired in order:

1. DataList_ItemCreated
2. IsPostBack
3. LinkButton_OnClick
4. DataList_OnCommand

It seems to build the DataList before it does anything.. I need to make adjustments on how it builds the datalist result based on the link that is clicked.. What am I doing wrong?

Cheers,

G.




Oxigen - Next generation business solutions
-----------------------------
Components/Tools/Forums/Software/Web Services
 
Problem solved!

It was as simple as setting EnableViewState="False"

Cheers,

G.

Oxigen - Next generation business solutions
-----------------------------
Components/Tools/Forums/Software/Web Services
 
Gorkem - glad you nailed it. I was too busy yesterday to take a close look. This is a good point to bring up - remember, for example with DataGrids/GridViews - that a small dataset returning with the Grid's viewstate = true can create a large viewstate value, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top