如何从aspx页面调用cs方法

如何从aspx页面调用cs方法

本文介绍了如何从aspx页面调用cs方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C sharp编写的程序,它从SQL Express数据库中读取数据。其中一个表中的一个字段使用我自己的加密方法加密。我有一个明智的想法来创建一个ASP.Net页面,以便我可以从我的Ipad访问数据。我一直在玩DOT网页,并拥有它,所以我可以从服务器读取数据。我现在需要的是一种通过我的加密方法从服务器运行输出的方法,这样数据将在aspx页面上以直接文本显示。我想将该方法添加到aspx页面并在数据绑定到网格之前调用它。有想法的人吗?谢谢

Everett

I have a program written in C sharp that reads data from a SQL Express database. One of the fields in one of the tables is encrypted with my own encryption method. I just got a bright idea to create a ASP.Net page so I could access the data from my Ipad. I have been playing around with the DOT Net page, and have it so I can read the data from the server. What I need now is a way to run the output from the server through my encryption method so the data will display in straight text on the aspx page. I want to add the method to the aspx page and call it before the data is bound to the grid. Anyone with any ideas? Thanks
Everett

推荐答案

using MyClassFiles;





..然后,您可以在aspx页面中调用它们的方法和属性,就像在任何其他应用程序中一样用C#编写。



我想建议,当你使用ASP.NET时,你必须尝试忽略在aspx中编写应用程序的业务逻辑(主代码)您要呈现HTML的页面。相反,您必须在代码隐藏中创建这些对象,并只调用函数和方法。此外,您必须尝试仅返回表示成功或错误的字符串。



.. then, you can call the methods and property of them in your aspx page, as you would in any other application written in C#.

I would like to recommend, when you're working with ASP.NET you must try to ignore writing the business logic of your application (main code) inside the aspx page where you're going to render the HTML. Instead, you must create these objects in the code-behind and just call the functions and methods. Also, you must try to return only the string that would indicate success or error.


这篇关于如何从aspx页面调用cs方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 04:12