You must Sign In to post a response.
  • Category: ASP.NET

    What is the benefit of calling function, method in .aspx page instead of .cs file

    Hi ! i am new in web programming.i have noticed that we can call a method or function by double clicking a button in .cs file in we can also call any function without double clicking in .aspx page. using on click function.

    we also insert,update,delete or load data using sqldatasource control in .aspx page.but we can also write same statement by writting code in .cs file.

    bu what is the benefit between this two way.

    please explain.
    thanks to all.
  • #762598

    Web application Working based page life cycle then
    so when we click command button write the code and put separate functions we can call from in our button click event so this is proper and right way like managed code.

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762599

    I suggest you to learn difference between inpage technique and code behind technique in

    After you write things in .aspx page those are visible to client if he click view page source.
    Where as if you write in .cs file these are stored in the server side, hence client cant see this logic written in .cs file.

    Client side validation functions we write in .aspx page to perform those at client with onClientClick event or any other.

    Content written in .cs file is secured where as .aspx page content is not secured can be viewed by clicking view page source.

    Sridhar Thota.
    Editor: DNS Forum.

  • #762600

    No need of double clicking. The button click logic in .cs file will be executed with the event of button click like this.

    Where as if you want client side button click logic in .aspx page the event will be like this.

    Sql datasource in aspx page you will just mention the which datasource id and few settings, but you wont write any logic in aspx page for edit,update and delete.
    You can use either direct datasource or you can write manual edit, update delete logic on .cs file.


    Sai Krishna Reddy.

  • #762605

    The purpose of SQLDataSource is it's connect to database directly and fetch data without wrote any code in code behind, like Connection open etc..

    And If you double click on button, at that time you need to manually open connection and build all the code stuffs.

    Hope this will helpful to you...

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #762621

    Now a days there are lot of persons expecting how to spoof website details or website design or something else .

    So if we wrote source in client side they are easily find the particular website details.That's why we can use server side script to avoid this problem as well.

    Hope this information will help you.

    Regards with,

  • Sign In to post your comments