Monday, 27 March 2017

Use single UserControl multiple times in ASP.Net Page dynamically

Use single UserControl  multiple times in ASP.Net Page dynamically

Step 1: Lets create our Solution




Step 2: In UCHome.ascx


<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCHome.ascx.cs" Inherits="UsingUserControlMultipleTimes.UCHome" %>
<div style="page-break-after:always">
    <asp:Label ID="lblName" Font-Bold="true" runat="server"></asp:Label>
</div>


Step 3: In UCHome.ascx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UsingUserControlMultipleTimes
{
    public partial class UCHome : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        public void UserName(string Name)
        {
            lblName.Text = Name;
        }
    }
}

Step 4: In Home.ascx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="UsingUserControlMultipleTimes.Home" %>
<%@ Register TagPrefix="HomePage" TagName="header" Src="UCHome.ascx" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
</body>
</html>

Step 5: In Home.ascx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UsingUserControlMultipleTimes
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
          
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            for (int i = 0; i < 5; i++)
            {
                UCHome myControl = (UCHome)LoadControl("UCHome.ascx");
                myControl.ID = "UCHome" + i.ToString();
                myControl.UserName("Testing " + i.ToString());
                myControl.Visible = true;
                this.form1.Controls.Add(myControl);

            }
        }
    }
}

Step 6: Run the Application


Friday, 13 January 2017

Setting Big Rock Custom domain as third party Custom url in Blogger


Setting Big Rock Custom domain as third party Custom url in Blogger

Step 1 : In your blogger Account. Go to settings -> basic as shown in below screenshot.


Step 2 : click on set up a third party url.

Step 3 : Enter your domain and click on save, a message will be shown (We have not able to verify your authority to this domain).

Step 4 : Open your Big Rock Account and click on your website link as shown in the snapshot.


Step 5 : Scroll down to DNS Management and click on Manage DNS.


Step 6 : Insert these 4 A Records.
i. 216.239.32.21
ii. 216.239.34.21
iii. 216.239.36.21
iv. 216.239.38.21


 Step 7 : Click on CNAME Record and insert the record as shown in the below snapshot.

Step 8 : Insert second record and click save.


Step 9 : All done just go back to your blogger and click save.