General tips for C# , .Net, SQL server users.

These are general tips for .Net user. Sometimes we spend large amount of time just to solve simple problem so in such case these tips will help you specially for beginners. If you like this article then please let me know. Happy coding!

1) How to get all records from the SQL server table other than select * from tablename?

SELECT ALL * FROM tablename.

2) Suppose you have dropdown inside the gridview and you want to show dropdown selected value same as value stored in table at runtime , then use following :

<asp:DropDownList ID="drpname" runat="server" SelectedValue='<%# Eval("Columname") %>'>

3) If you want to specify a percentage of records then use following :

SELECT TOP (25) PERCENT column name1 , column2 from tablename

4)How to use confirmation box using javascript?

<script type="text/javascript">
function UseConfirmboxApplication() {
var answer = confirm("Quit the application?")
if (answer){
alert("You are about to leave this application.")
window.location = "";
alert("You will remain in this application.")
<input type="button" onclick="UseConfirmboxApplication()" value="Quit Confirmation">


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: