Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Tuesday, 1 December 2015

How to call .cs file from .aspx.cs file in asp.net c#?


Today in Engineer's World, we are discussing a C# query faced by a developer in very easy way. Posted By- +Manish Kumar Gautam +LIVE VIAR  +ASP.NET SOLUTIONS

Click imagination hunt to see latest Blogs


Calling .cs (class file) from .aspx.cs (webform code behind file) in Asp.net C#

This question is very general. And is faced by almost everyone including me. So, I have tried something which will be very helpful to everyone and beginners.

To understand this let's create a new website.



Select Asp.net Empty website. After writing the file name click OK button.



Right Click on the website title in the Solution Explorer -> Add -> Choose Web Form (or Add New Item) -> Write the appropriate web form name and click OK button.







Similarly, to add a class file. Right click on project title -> Add new item.



Choose Class file. Write the file name and click the Add button.



An alert box will appear, that will ask that all the class file will be added in 'App_Code' folder. Click 'Yes' button. It is not necessary; you can add your own folder. But, it's good to keep all your class file in 'App_Code' as it will keep your files well organized and easily managed.



You can see that only your class file is added in the 'App_Code' folder.




Related Questions:

Q-1 Why class files need to add in 'App_Code' folder?
Ans. Files need to be add in 'App_Code' folder because:
A) It not only store class file, but it can also store various other the files, such as typed data set, text files, and reports. And it will automatically compile at run-time.
B) Files can be easily accessible through the project.
C) One of the important features of the App_Code folder is that only one .dll is created for the complete folder, irrespective of how many files it contains when we publish our project.

Q-2 Can we access a class file that is declared in the 'App_Code' within our entire application?
Ans. Yes. Files declared can be easily accessible through the project.

Click imagination hunt to see latest Blogs

Keep learning and sharing...

47 comments:

  1. Cool blog! Is your theme custom made or did yoou download it from
    somewhere? A design like yours with a few simple
    adjustedments would really make my blog shine. Please let me
    knlw where you got your theme. Bless you

    ReplyDelete
  2. Hi theree tto all, the contents present at this site are actually amazing for peole knowledge, well,
    keep upp the nihe work fellows.

    ReplyDelete
  3. This post is geniinely a fastidious one it assists new neet people, who are wishing in fvor of blogging.

    ReplyDelete
  4. Hello my family member! I want to say that this post iss awesome, nice written and include almoxt all significant infos.
    I would like to look extra posts like this .

    ReplyDelete
  5. Hurrah, that's what I was looking for, what a data! existing here
    at this web site, thanks admin of this web site.

    ReplyDelete
  6. A motivating discussion is worth comment. I believe that youu
    ought to write morre about this subject, it might not bee a taboo matter but typically people don't
    talk about such topics. To thee next! Kind regards!!

    ReplyDelete
  7. Right away I am going away to do my breakfast, when having my breakfast coming again to red additional news.

    ReplyDelete
  8. Nice replies in return of thhis matte with real arguments
    and explaining everything on the topic of that.

    ReplyDelete
  9. I am in fact grateful to the owner of this web page who
    has shared this wonderful paragraph at here.

    ReplyDelete
  10. Heyy There. I foujnd your blog using msn. This is a very well
    written article. I'll make sure to bookmark it and come back to read more
    of your useful information. Thanks for the post.
    I'll definitely comeback.

    ReplyDelete
  11. Quality posts is the secret to invite the visitors to pay a quick visiit the web site, that's what this site is providing.

    ReplyDelete
  12. Hello Dear, are you really visiting this web pae on a regular basis,
    if so afterwad you will absolutely obtain pleasant know-how.

    ReplyDelete
  13. With havin so much written content doo you ever run inbto any issues of plagorism or copyright infringement?
    My siite has a lot of exclusive content I've eithsr created myself or outsourced but it looks like
    a lot of itt is popping it up all over the internet without my
    agreement. Do you know any ways to help reuce content from being ripped off?
    I'dcertainly appreciate it.

    ReplyDelete
  14. What a information of un-ambiguity and preserveness of precious experiene
    concerning unexpectesd feelings.

    ReplyDelete
  15. An intriguing discussion is definitely worth comment.
    There's no doubt that that youu need to publish more on this topic,
    iit may not be a taboo matter but generally people do not talk about thes topics.
    To the next! Many thanks!!

    ReplyDelete
  16. Hi just wanted to give you a brif heads up and let you know a
    few of the images aren't loading properly.
    I'm nnot sure why but I think its a linking issue.
    I've tried it in two different web browsers and both how the same results.

    ReplyDelete
  17. I'm curious too find out what blog platform you happen to be working with?
    I'm having some minor security problems with my lateest site and I would like to find something
    more risk-free. Do you have any recommendations?

    ReplyDelete
  18. whoah this blog iis excellent i like reading your posts.
    Keep up the great work! You understand, a lot of prsons are
    hunting arfound for this info, you can aid them greatly.

    ReplyDelete
  19. This design is spectacular! You certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to startt my own blog (well,
    almost...HaHa!) Great job.I really loved what yoou had to say,
    and mofe than that, how you presented it. Too cool!

    ReplyDelete
  20. It's a pity you don't have a donate button! I'd most certainly donate
    to this brilliant blog! I suppose for now i'll settle for bookmarking and adding
    your RSS feed to my Google account. I look forward to brand new
    updates and will share this blog wiuth my
    Facebook group. Chat soon!

    ReplyDelete
  21. Have you ever considered publishing an e-book or guest authoring
    onn other sites? I have a blog based upon on the same ideas you discuss and would really like to have you
    share some stories/information. I know my visitors
    would enjoy your work. If you're even remotely interested, feel free to sed me an e
    mail.

    ReplyDelete
  22. I've been surfing online more than 3 hours today, yet
    I never found any interesting article like yours. It is pretty
    worth enough for me. Personally, if all webmasters and bloggers made good content aas you did, the web will be much more useful
    than ever before.

    ReplyDelete
  23. Excellent post. Keep writing such kind of information on yopur page.
    Im really impressed by your site.
    Hello there, You have performed a great job.
    I'll definitely digg it and in my opinion recommend to my friends.
    I am confident they will be benefited from this web site.

    ReplyDelete
  24. We're a bunch of volunteers and opening a brand new scheme in our
    community. Your site offered us with useful info to work on.
    You've performed a formidable job and our entire group might be grateful too you.

    ReplyDelete
  25. Excellent pieces. Keep posting such kind oof information on your blog.
    Im really impressed by your blog.
    Hey there, You have performed an excellent job. I wkll definitely
    digg it and for my part suggest to my friends.
    I am suee they'll be benefited from this site.

    ReplyDelete
  26. I like reading ann article that will make people think.
    Also, thanks for permitting me to comment!

    ReplyDelete
  27. I'm not sure where you are getting your information, but good topic.
    I needs to spend soje time lewrning much moire or understanding more.

    Thanks for excellent info I waas looking for this information for mmy mission.

    ReplyDelete
  28. Hello too all, how is all, I think every one is getting more from this website, andd
    your views are nice deswigned for new users.

    ReplyDelete
  29. Quality articles or revioews is the key to be
    a focus for the users to ppay a visit the web site,
    that's what this website is providing.

    ReplyDelete
  30. I just like the helptul info you provide to your articles.
    I will bookmark your blog and take a look at again right here frequently.
    I'm relatively sure I'll learn plenty of new stuff proper right here!
    Best of luck for the following!

    ReplyDelete
  31. I used to be recommended this website by means of my cousin.
    I am no longer sure whether or not this publish iss written via
    him as nobody else know such targeted about mmy problem.
    You're wonderful! Thank you!

    ReplyDelete
  32. Hi there! I'm at work browsing your blog from my new iphone 3gs!
    Just wanted to say I love reading turough your blog and
    look forward to all your posts! Cadry on the superb work!

    ReplyDelete
  33. Wonderful beat ! I would like to apprentice while you amend your website, how can i subscribe for a blog site?

    The account aidedd me a acceptable deal. I had been tiny bit acquainted of this your
    broadcast offered bright clerar concept

    ReplyDelete
  34. After looking over a handful of the blog posts on your blog, I honestly appreciate your
    way of writing a blog. I saved as a favorite it to my bookmark website ist and will be checking baack soon. Please check out my website
    as well and tell me how you feel.

    ReplyDelete
  35. I do trust all of the concepts you've introduced
    oon your post. They are very convincing and will definitely work.
    Still, the posts are too short for starters.

    May you please lengthen them a bit from next time? Thank you for thee
    post.

    ReplyDelete
  36. Marvelous, what a web site it is! This weblog preesents helpful information to us, keep it up.

    ReplyDelete
  37. I'm gone to inform my little brother, that he should also pay a quick visit this blog on regular basis to obtain updated
    from latest news update.

    ReplyDelete
  38. I blog quite often and I seriously appreciate
    your content. This great article has truly peaked my interest.
    I am going to book mark your website and keep checking for new details about once per
    week. I opted in for your RSS feed ass well.

    ReplyDelete
  39. It is appropriate time to make some plans forr tthe future and it is time to bee
    happy. I've read this post and if I could I want to suggest you few interesting things or advice.
    Perhaps you can write next articles referring to this article.
    I want to read more things about it!

    ReplyDelete
  40. Greetings, I believe your blog could bbe having web broser compatibility problems.
    When I take a look at your blog in Safari, it looks fone however, if opening
    in Internet Explorer, it has some overlapping issues.

    I just wanted to provide you with a quick heads up! Aside from that,
    wonderful site!

    ReplyDelete
  41. It's actually a great and helpfuhl piece of info.
    I'm satiisfied that you just shared this useful info wjth us.

    Please keep us up to date like this. Thanks for sharing.

    ReplyDelete
  42. Hi there it's me, I am also visiting this web page on a
    regular basis, this site is genuijnely pleasant and the visityors
    are really sharing good thoughts.

    ReplyDelete
  43. Fantastic goods from you, man. I've remember your
    stuff previous to and you're simply extremely great.
    I really like what you've acquired here, really like what you are sayiong and the way
    in which you are saying it. You are making it enteraining and you still take care of
    to sty it smart. I can not wait to read far more frolm you.
    That is actually a wonderful web site.

    ReplyDelete
  44. I am regular visitor, how are yyou everybody? This paragrapoh postted at this site is iin fact nice.

    ReplyDelete
  45. Helpo There. I found your weblog the use of msn. This is
    an extremely neatly written article. I'll make sure to
    bookmark itt and come back to learn more of your useful info.
    Thanks for the post. I'll certainly comeback.

    ReplyDelete
  46. Pretty portion of content. I simply stumbled upon your weblog and in accession capital to say
    that I get in fact loved account your weblog posts.
    Any wayy I wll be subscribing in your augment and
    even I fulfillment you get admission to persistently quickly.

    ReplyDelete
  47. I know this site gives quality based articles
    or reviews and other material, is there any other web paqge which offers these stuff
    in quality?

    ReplyDelete

Featured post

Think that makes you rich and richer

 Napolean said: “You can think and grow rich, but if you can be brought up like most people with work and you won't starve, this wil...