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?
<html>
<head>
<script type="text/javascript">
function UseConfirmboxApplication() {
var answer = confirm("Quit the application?")
if (answer){
alert("You are about to leave this application.")
window.location = "http://www.google.co.in/";
}
else{
alert("You will remain in this application.")
}
}
</script>
</head>
<body>
<form>
<input type="button" onclick="UseConfirmboxApplication()" value="Quit Confirmation">
</form>
</body>
</html>