Zdravím, Hraju si s IronPython a ASP.NET. V default.aspx mám: <%@ Page Language="IronPython" CodeFile="Default.aspx.py" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_OnClick" /> </div> </form> </body> </html> V default.aspx.py mám: import clr clr.AddReference('System.Data') clr.AddReference('System.Configuration') clr.AddReference('System.Web') from System.Data import * from System.Configuration import * from System.Web import * from System.Web.Security import * from System.Web.UI import * from System.Web.UI.WebControls import * from System.Web.UI.WebControls.WebParts import * from System.Web.UI.HtmlControls import * class utils(object): f = file('c:\\test.txt','a') c = 0 def Page_Load(sender, e): pass def Button1_OnClick(sender, e): u = utils() u.c = u.c + 1 Label1.Text = "Hello World: " + str(u.c) u.f.write("Hello World: " + str(u.c) + "\n") Problém je, že hodnota proměné "c" je stále 1. Chci dosáhnout toho, aby se mi při klikání na tlačítko vždy zvýšila o jednu. Nevíte někdo jak toho dosáhnout? Díky, David
_______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python
