Formview and button

Hi,

I have problems with code-behind. In my code behind I have this code: 

private void InitializeComponent()

{

this.Button2.Click += new System.EventHandler(this.Button1_Click);

The Button2 I have in Formview with ID=Formview2 :

<asp:FormView ID=”FormView2″ runat=”server” DataSourceID=”SqlDataSource2″ >

<InsertItemTemplate

>

 

<asp:button id=”Button2″ runat=”server” Text=”Ulož na server”></asp:butto>

 

And when I launch it, so Compiler say this:

 Compiler Error Message: CS0117: ‘Detail’ does not contain a definition for ‘Button1’

Source Error:

 
Line 54: Line 55: { Line 56: this.Button1.Click += new System.EventHandler(this.Button1_Click);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s