Crete Connection with connection string.  SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[“PropertyGuruConnectionString”].ToString());     //Make an Open Connection to the SQL Server database //Here ‘PropertyGuruConnectionString’ is the name of the string used for connection with database //Our aim is to add Checkbox values in Database //Lets Add a three checkboxes with different values and a button to submit those values in database table. //We need to create the database table for storing values as well. On Button Click Here Three Checkboxes have Respective Ids – chkApartment, chkVilla, chkRest protected void btnPropType_Click(object sender, EventArgs e)     {         if (chkApartment.Checked == true)         {            lblRandom3.Text = “Apartment”;        Read More →

It is sometimes needed to generate random integers in C# programming. Random integers can be used  for human verification in Math Captcha . Random integers can be used for sms verification etc. Let’s see how to do it. Our Aspx Code <asp:Content ID=”Content2″ ContentPlaceHolderID=”MainContent” Runat=”Server”>     <asp:Label ID=”lblRandom” runat=”server” Text=”Label”></asp:Label>     <asp:Label ID=”lblRandom2″ runat=”server” Text=”Label”></asp:Label>     <asp:Label ID=”lblSum” runat=”server” Text=”Label”></asp:Label> </asp:Content> lblRandom for generation of 1st Random Character lblRandom2 for generation of 2nd Random Character lblSum to generate Sum of 2 random numbers Now C# Code – protected void Page_Load(object sender, EventArgs e)     {         Random rnd = new Random();         int month =Read More →

A Folder Named App_Code is created by Visual Studio in our Application by Default. We have to create a Public Class in that folder. And then write our function which we want to replicate in multiple pages. Then :- In the respective pages simply create the object of that public class, all the objects will be able to access all the public functions of that class. In the class (in App_code) public class themainclass {    public void tobereplicatedfuntion()    {       // Do Something you want to replicate } ____________________ In Respective Pages (New object ) themainclass objthemainclass = new themainclass(); objthemainclass.tobereplicatedfuntion(); _________________________________________  Read More →