OnCommand Problem with Linkbutton as a TemplateItem

OnCommand Problem with Linkbutton as a TemplateItem

Post by JSanford94 » Thu, 16 Nov 2006 04:45:38


Hi All,

I have a Repeater that contains a LinkButton as one of the items in the
ItemTemplate. I have the OnCommand (method is called "messageActions")
and CommandName ("view") properties set, as well as a CommandArgument
for the LinkButton to fire off when clicked. For some reason, when I
try to set the CommandEventHandler for the LinkButton:

this.messageSubject.Command += new CommandEventHandler(messageActions);


I get an object reference runtime error. I have the LinkButton
delcared.

Can someone give me an example on the correct way to set this up so my
method will fire? My code snippet is below. Thanks so much in advance!

<asp:Repeater ID="messageRepeater" Runat="server">
<ItemTemplate>
<asp:LinkButton ID="messageSubject" OnCommand="messageActions"
CommandName="view" CommandArgument='<%#
DataBinder.Eval(Container.DataItem,"Id") %>' Runat="server"><%#
DataBinder.Eval(Container.DataItem,"MessageSubject")
%></asp:LinkButton>
</ItemTemplate>

protected void messageActions(Object sender, CommandEventArgs e)
{
string command = e.CommandName;
switch (command)
{
(do something)
}
}
 
 
 

1. cloud of AS's

2. TemplateItem.Zip files for a Report Server 2005 Project

Where are you supposed to place the .zip files that can be generated with
"Export Template" so that they show up under "My Templates" in a SQL Report
Server 2005 project ?

I know that for non SQL Server projects you place the zip file in:
C:\Documents and Settings\USERNAME\My Documents\Visual Studio
2005\Templates\ItemTemplates.

And I know that you can extract the .rdl file from the zip file and place it
in:
C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject

BUT .. the whole thing about having to extract the .rdl from the zip file is
a nuisance and is causing havoc with the rollout of changes to the
templates.

Anybody know ?

3. updates and patches via OnCommand ?

4. TAPI 2.x - Reset/Init Modem onCommand

5. Can OnCommand event be added on the server side?

6. User Control and dynamic LinkButton problem

7. Gif Tranparency problems on LinkButton in Datagrid

8. LinkButton Inherited from WebControl problem?

9. LinkButton Problem

10. Problem adding dynamic LinkButton[] Array with event to a page

11. Problems with linkbuttons after XP SP2

12. Problem in LinkButton

13. Urgent:Linkbutton problem!

14. Problem with Changing text value of linkbutton

15. Problems with the Accordion-Control+LinkButton