Hi jitendlad,
You need to add "runat = "server"" in your div.I have given below example. So please refer the below code.
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.h1
{
background-color: Maroon;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="div1" runat="server">
<p>
This Is Test Page</p>
</div>
</form>
</body>
</html>
C#
div1.Attributes["class"] = "h1";