Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everyone
i have master page and
web page using master page with name index
when add button in index in
ASP.NET
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

 
    <asp:Button ID="Button3" runat="server" onclick="Button3_Click" Text="Button" />


click event is not work thanks for any help
Posted
Updated 27-Jul-12 10:56am
v2

1 solution

If this is being added to the same aspx as the event code is in the code behind ( you're not clear, if you're adding the button to your derived page, and the event in your master page, which won't work ), then there is no reason for this not to work. Does it do a postback at all and the event is not called ? We need more info.
 
Share this answer
 
Comments
Christian Graus 27-Jul-12 17:42pm    
This code is poorly formed. You don't close your asp:Content tags, you have a closing script tag with no opening tag. Without the closing Content tags, I am surprised you even get a button. Have you set a breakpoint to make sure it's not being clicked ?
Mostafa Elsadany 27-Jul-12 17:44pm    
<![CDATA[<%@ Page Title="" Language="C#" MasterPageFile="~/Site_Main.Master" AutoEventWireup="true" CodeBehind="Home_setting.aspx.cs" Inherits="Lab.CP.Home_setting" %>]]>



<![CDATA[<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>]]>

<asp:content id="Content1" contentplaceholderid="head" runat="server" xmlns:asp="#unknown">


<asp:content id="Content2" contentplaceholderid="ContentPlaceHolder1" runat="server" xmlns:asp="#unknown">


<asp:button id="Button3" runat="server" onclick="Button3_Click" text="Button" />




code :
protected void Button3_Click(object sender, EventArgs e)
{
Response.Write("sdaaaaaaaaaaaaa");
}

is not work when click on button
Mostafa Elsadany 27-Jul-12 17:45pm    
i closed but t when write here is removed i don't know why
Christian Graus 27-Jul-12 17:50pm    
Oh. You have 'onclick', which is a client side event. You want 'OnClick', which is the ASP.NET event. It's case sensitive.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900