Thursday 15 May 2014

c# - Calling a class from a button on an aspx page -


My page just starts refreshing I can not call lottext () class onclick.

ASPX:

  & lt;% @ Page language = "C #" AutoEventWireUp = "True" codebahind = "Draw.aspx C . " Inherits = "Lotto.Dra"%> & Lt ;; DOCTYPE HTML PUBLIC "- // W3C // DTT XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Head runat = "server" & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "form1" runat = "server" & gt; & Lt; Div & gt; & Lt; H1 & gt; Welcome to the Lotto Draw & lt; / H1> & Lt; Asp: button id = "button1" runat = "server" text = "draw" OnClientClick = "lottoTest ()" /> & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

Draw.aspx.cs

 using the  system; Using System.Collections.Generic; Using System.Linq; Using System.Web; Using System.Web.UI; Using System.Web.UI.WebControls; Namespace Lotto {Public Partial Class Draw: System. Web. UI Page {Secure Zero Page_load (Object Sender, EventAGRS E) {} Public Empty Lottoest () {dictionary    

The issue is that you are requesting the client on OnClientClick Click (Without Brackets)

Then change your method signature to: Public Zero Lottoast (Object Sender, EventArgse E) instead of Public Zero Lottoest ()

No comments:

Post a Comment