1
Answer

Windows Services - Best practices question???

alejandro.rivera

alejandro.rivera

20y
1.9k
1
Hi All, I'm not sure if this is the place to post this question but I didn't see a forum just for Windows Services. If anyone can please help me by answering my questions or by pointing me in the right direction I'd really appreciate it. I wanted to know which is better, to have one service in one process or to have multiple services in one process? I see that in .NET it allows you to start multiple services under one process. Also, if one of your services crashes does it crash all of the services that are in the same process? I'm new to .NET and C# so any help would be highly appreciated. Can anyone point me to some real good samples for Windows Services because all the ones I find are so basic they have no meat and potatos to them.
Answers (1)
2
Deepak Verma
NA 1.7k 690.4k 12y

Attachment menudemo.zip

Hi Dinesh,

Refer to this code:

Master Page:

<head runat="server">
  <title></title>
 
  <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
 
  <script src="jquery-1.6.2.js" type="text/javascript"></script>
 
  <script type="text/javascript">
 
  $(document).ready(function () {
  $(".menuLinks").click(function () {
  $(".menuLinks").removeClass("selected");
  });
  });
  </script>
 
  <asp:ContentPlaceHolder ID="head" runat="server">
 
  </asp:ContentPlaceHolder>
 </
head>
 <
body>
  <form id="form1" runat="server">
 
  <div>
 
  <ul class="menu">
 
  <li><a id="link1" class="menuLinks" href="Page1.aspx" runat="server">Link 1</a></li>
 
  <li><a id="link2" class="menuLinks" href="Page2.aspx" runat="server">Link 2</a></li>
 
  <li><a id="link3" class="menuLinks" href="Page3.aspx" runat="server">Link 3</a></li>
 
  </ul>
 
  <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
 
  </asp:ContentPlaceHolder>
 
  </div>
 
  </form>
 </
body>
 

StyleSheet.css :

ul.menu li
 
{
  float: left;
  list-style: none;
 }
 ul.menu
li a
 
{
  text-decoration: none;
  font-family: Tahoma;
  font-size: 20px;
  margin: 0px 10px 0px 0px;
  padding: 3px;
  background-color: Black;
  color: White;
  border-radius: 5px;
 }
 ul.menu li a:hover
 
{
  background-color: Blue !important;
 }
 ul.menu li a.selected
 
{
  background-color: Blue !important;
 } 

Page1.aspx.cs :

 protected void Page_Load(object sender, EventArgs e)
  {
  ((HtmlAnchor)this.Page.Master.FindControl("link1")).Attributes.Add("class", "selected");
  }

Page2.aspx.cs :

 protected void Page_Load(object sender, EventArgs e)
  {
  ((HtmlAnchor)this.Page.Master.FindControl("link2")).Attributes.Add("class", "selected");
  }

Page3.aspx.cs :

 protected void Page_Load(object sender, EventArgs e)
  {
  ((HtmlAnchor)this.Page.Master.FindControl("link3")).Attributes.Add("class", "selected");
  }

Accepted
0
Dinesh Ambaliya
NA 42 59.8k 12y
This will work. Thank you.