943,525 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 3661
  • ASP.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
Apr 19th, 2009
0

how should i do it?

Expand Post »
Hi,

Im creating a website that will be used to monitor servers, the user can add and remove servers and the servers list will be constantly chaning.

I need to create a generic page to display the monitoring results that will adapt depending on which server the user selects. The graphs and results dispalyed will always be the same however the data will change depending on which server is selected. How would i go about doing this and is there any good examples online?

Would i need to create new pages as servers are loaded? or could i use a master page that changes depending on server?
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Apr 19th, 2009
0

Re: how should i do it?

FOR REFRESH YOU CAN USE AJAX. TO LEARN MORE ON THIS GO TO asp.net learn section. Server means what? Just input & then save??? Need to know details. For graph you can use fusion chart which is free.
Reputation Points: 26
Solved Threads: 44
Posting Whiz in Training
mail2saion is offline Offline
247 posts
since Apr 2009
Apr 19th, 2009
0

Re: how should i do it?

hi,

I mean like a windows server or unix server basically monitoring computers and I would like to have one template that could be used for every server, the data about each server is stored in a sql database so when the user selects say server1 it will load the template with all the information about server1, but if they chose server2 then it will load all the information about server2. I need to know whether this should be done with a master page i.e create the template then each time a new server is added it will create a page based on that template or is there another way which would be better?
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Apr 19th, 2009
0

Re: how should i do it?

Basically MASTER page is used for a common header, footer or left menu purpose. According to your why you think complex. Its easy i think. You can design an aspx page which will be the master page. Then design child page.

In master page you will show the list of available/active servers in a GridView.
When user click on a row then redirect to the child page by the selected server id. In child page select child details by a select statement where serverid=querystring value.

Let me know if you cant understand.
Reputation Points: 26
Solved Threads: 44
Posting Whiz in Training
mail2saion is offline Offline
247 posts
since Apr 2009
Apr 19th, 2009
0

Re: how should i do it?

hi,

That is exactly how i have done it so far. Have a sql query on my homepage which returns a list of the servers that the program is monitoring. I have selected the option make them selectable and would like it to take the user to a page depending on which is selected i have done it using gridview code below, however when they are selected nothing happens do i need to put something in the code file to make this happen? are there any good examples
ASP.NET Syntax (Toggle Plain Text)
  1. <asp:GridView ID="ListOfServers" runat="server" AllowPaging="True"
  2. AllowSorting="True" AutoGenerateColumns="False" BorderStyle="Solid"
  3. BorderWidth="2px" CaptionAlign="Bottom" CellPadding="4" DataKeyNames="ServerID"
  4. DataSourceID="SqlDataSource1" Font-Bold="True" Font-Names="Cordia New"
  5. Font-Size="Medium" ForeColor="#333333" HorizontalAlign="Center"
  6. ToolTip="This table contains the current list of monitored servers."
  7. Width="95%">
  8. <RowStyle BackColor="#EFF3FB" />
  9. <Columns>
  10. <asp:CommandField ShowSelectButton="True" />
  11. <asp:BoundField DataField="ServerID" HeaderText="ServerID"
  12. InsertVisible="False" ReadOnly="True" SortExpression="ServerID" />
  13. <asp:BoundField DataField="HostName" HeaderText="HostName"
  14. SortExpression="HostName" />
  15. <asp:BoundField DataField="MachineType" HeaderText="MachineType"
  16. SortExpression="MachineType" />
  17. <asp:BoundField DataField="Kernel" HeaderText="Kernel"
  18. SortExpression="Kernel" />
  19. <asp:BoundField DataField="SerialNo" HeaderText="SerialNo"
  20. SortExpression="SerialNo" />
  21. <asp:BoundField DataField="PrimaryIP" HeaderText="PrimaryIP"
  22. SortExpression="PrimaryIP" />
  23. </Columns>
  24. <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  25. <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  26. <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  27. <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  28. <EditRowStyle BackColor="#2461BF" HorizontalAlign="Center"
  29. VerticalAlign="Middle" Wrap="True" />
  30. <AlternatingRowStyle BackColor="White" />
  31. </asp:GridView>
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Apr 20th, 2009
0

Re: how should i do it?

YOU CAN ACHIEVE THIS IN THE FOLLOWING WAY:
ASP.NET Syntax (Toggle Plain Text)
  1. <asp:TemplateField HeaderText="Action">
  2. <ItemTemplate>
  3. <asp:Label ID="lblEdit" runat="server" Text='<%# "<a href=frmAgents.aspx?Cmd=EDIT&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Edit</a>"+" | "+ "<a onclick="+ch+"return ConfirmChoice()"+ ch +" href=frmAgents.aspx?Cmd=DELETE&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Delete</a>" %>'></asp:Label>
  4. </ItemTemplate>
  5. <ItemStyle HorizontalAlign="Center" />
  6. <HeaderStyle HorizontalAlign="Center" />
  7. </asp:TemplateField>
Reputation Points: 26
Solved Threads: 44
Posting Whiz in Training
mail2saion is offline Offline
247 posts
since Apr 2009
Apr 20th, 2009
0

Re: how should i do it?

hi,

Where would I put this code. I put it directly after the code I showed you before but it gave errors, do I need to add new controls to the website first? Errors are as follows:

ASP.NET Syntax (Toggle Plain Text)
  1. Error 10 'System.Web.UI.Control' does not contain a definition for 'DataItem' and no extension method 'DataItem' accepting a first argument of type 'System.Web.UI.Control' could be found (are you missing a using directive or an assembly reference?) C:\Users\chris\Documents\work\uni\year3\project\website\Home.aspx 54
Complete code for home page
ASP.NET Syntax (Toggle Plain Text)
  1. <%@ Page Language="C#" MasterPageFile="~/Master1.master" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" Title="Site Health Home Page" %>
  2. <%@ MasterType virtualpath="~/Master1.master" %>
  3. <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  4. <h1 style="text-align: center; color: #FFFFFF;">
  5. <asp:Label ID="CompanyName" runat="server" style="font-size: x-large"
  6. Text="Label"></asp:Label>
  7. </h1>
  8. <p>
  9. You are currenlty
  10. monitoring
  11. <asp:Label ID="serverCount" runat="server" Text="servercount"></asp:Label>
  12. Solaris Servers:</p>
  13. <p>
  14. <asp:GridView ID="ListOfServers" runat="server" AllowPaging="True"
  15. AllowSorting="True" AutoGenerateColumns="False" BorderStyle="Solid"
  16. BorderWidth="2px" CaptionAlign="Bottom" CellPadding="4" DataKeyNames="ServerID"
  17. DataSourceID="SqlDataSource1" Font-Bold="True" Font-Names="Cordia New"
  18. Font-Size="Medium" ForeColor="#333333" HorizontalAlign="Center"
  19. ToolTip="This table contains the current list of monitored servers."
  20. Width="95%">
  21. <RowStyle BackColor="#EFF3FB" />
  22. <Columns>
  23. <asp:CommandField ShowSelectButton="True" />
  24. <asp:BoundField DataField="ServerID" HeaderText="ServerID"
  25. InsertVisible="False" ReadOnly="True" SortExpression="ServerID" />
  26. <asp:BoundField DataField="HostName" HeaderText="HostName"
  27. SortExpression="HostName" />
  28. <asp:BoundField DataField="MachineType" HeaderText="MachineType"
  29. SortExpression="MachineType" />
  30. <asp:BoundField DataField="Kernel" HeaderText="Kernel"
  31. SortExpression="Kernel" />
  32. <asp:BoundField DataField="SerialNo" HeaderText="SerialNo"
  33. SortExpression="SerialNo" />
  34. <asp:BoundField DataField="PrimaryIP" HeaderText="PrimaryIP"
  35. SortExpression="PrimaryIP" />
  36. </Columns>
  37. <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  38. <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  39. <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  40. <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  41. <EditRowStyle BackColor="#2461BF" HorizontalAlign="Center"
  42. VerticalAlign="Middle" Wrap="True" />
  43. <AlternatingRowStyle BackColor="White" />
  44. </asp:GridView>
  45. <asp:SqlDataSource ID="SqlDataSource1" runat="server"
  46. ConnectionString="<%$ ConnectionStrings:sitehealthConnectionString %>"
  47.  
  48. SelectCommand="SELECT [ServerID], [HostName], [MachineType], [Kernel], [SerialNo], [PrimaryIP] FROM [T_Servers]"
  49. onselecting="SqlDataSource1_Selecting">
  50. </asp:SqlDataSource>
  51. </p>
  52. <asp:TemplateField HeaderText="Action">
  53. <ItemTemplate>
  54. <asp:Label ID="lblEdit" runat="server" Text='<%# "<a href=frmAgents.aspx?Cmd=EDIT&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Edit</a>"+" | "+ "<a onclick="+ch+"return ConfirmChoice()"+ ch +" href=frmAgents.aspx?Cmd=DELETE&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Delete</a>" %>'></asp:Label>
  55. </ItemTemplate>
  56. <ItemStyle HorizontalAlign="Center" />
  57. <HeaderStyle HorizontalAlign="Center" />
  58. </asp:TemplateField>
  59. <p>
  60. &nbsp;</p>
  61. <p>
  62. Site Health Service Status:
  63. <asp:Label ID="serviceStatusLabel" runat="server" Font-Bold="True" Text="Label"
  64. ToolTip="If the service isn't started this application wont work"></asp:Label>
  65. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  66. <asp:Button ID="StopService" runat="server" Text="Stop Service"
  67. onclick="StopService_Click1" />
  68. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  69. <asp:Button ID="StartService" runat="server" Text="Start Service"
  70. onclick="StartService_Click1" />
  71. </p>
  72. <p>
  73. &nbsp;</p>
  74. <p>
  75. Page Refresh Time
  76. <asp:DropDownList ID="RefreshTime" runat="server" AppendDataBoundItems="True"
  77. AutoPostBack="True" onselectedindexchanged="RefreshTime_SelectedIndexChanged"
  78. ToolTip="Sets the refresh time of the current page">
  79. <asp:ListItem Value="10">10 Seconds</asp:ListItem>
  80. <asp:ListItem Value="30">30 Seconds</asp:ListItem>
  81. <asp:ListItem Value="60">60 Seconds</asp:ListItem>
  82. <asp:ListItem Value="300">5 Minutes</asp:ListItem>
  83. <asp:ListItem Value="600">10 Minutes</asp:ListItem>
  84. <asp:ListItem Value="3">3 seconds</asp:ListItem>
  85. <asp:ListItem Value="5">5 seconds</asp:ListItem>
  86. </asp:DropDownList>
  87. &nbsp;
  88. <asp:Label ID="fresh" runat="server" Text="Label"></asp:Label>
  89. </p>
  90. <p>
  91. &nbsp;</p>
  92. <p>
  93. <asp:SqlDataSource ID="SqlDataSource2" runat="server"
  94. ConnectionString="<%$ ConnectionStrings:sitehealthConnectionString %>"
  95. DatasourceMode="DataSet"
  96. onselecting="SqlDataSource2_Selecting"
  97. SelectCommand="SELECT COUNT(*) FROM T_Servers"></asp:SqlDataSource>
  98. </p>
  99. </asp:Content>
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Apr 20th, 2009
0

Re: how should i do it?

Hi,

The previous poster suggested to place the code he gave in to gridview not outside it.
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007
Apr 21st, 2009
0

Re: how should i do it?

hi im very new to all this any chance you could post the code back with where it should be, i have tried putting it into grid view but still get errors!
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Apr 22nd, 2009
0

Re: how should i do it?

hi,

check this

ASP.NET Syntax (Toggle Plain Text)
  1. <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  2. <h1 style="text-align: center; color: #FFFFFF;">
  3. <asp:Label ID="CompanyName" runat="server" style="font-size: x-large"
  4. Text="Label"></asp:Label>
  5. </h1>
  6. <p>
  7. You are currenlty
  8. monitoring
  9. <asp:Label ID="serverCount" runat="server" Text="servercount"></asp:Label>
  10. Solaris Servers:</p>
  11. <p>
  12. <asp:GridView ID="ListOfServers" runat="server" AllowPaging="True"
  13. AllowSorting="True" AutoGenerateColumns="False" BorderStyle="Solid"
  14. BorderWidth="2px" CaptionAlign="Bottom" CellPadding="4" DataKeyNames="ServerID"
  15. DataSourceID="SqlDataSource1" Font-Bold="True" Font-Names="Cordia New"
  16. Font-Size="Medium" ForeColor="#333333" HorizontalAlign="Center"
  17. ToolTip="This table contains the current list of monitored servers."
  18. Width="95%">
  19. <RowStyle BackColor="#EFF3FB" />
  20. <Columns>
  21. <asp:CommandField ShowSelectButton="True" />
  22. <asp:BoundField DataField="ServerID" HeaderText="ServerID"
  23. InsertVisible="False" ReadOnly="True" SortExpression="ServerID" />
  24. <asp:BoundField DataField="HostName" HeaderText="HostName"
  25. SortExpression="HostName" />
  26. <asp:BoundField DataField="MachineType" HeaderText="MachineType"
  27. SortExpression="MachineType" />
  28. <asp:BoundField DataField="Kernel" HeaderText="Kernel"
  29. SortExpression="Kernel" />
  30. <asp:BoundField DataField="SerialNo" HeaderText="SerialNo"
  31. SortExpression="SerialNo" />
  32. <asp:BoundField DataField="PrimaryIP" HeaderText="PrimaryIP"
  33. SortExpression="PrimaryIP" />
  34. <asp:TemplateField HeaderText="Action">
  35. <ItemTemplate>
  36. <asp:Label ID="lblEdit" runat="server" Text='<%# "<a href=frmAgents.aspx?Cmd=EDIT&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Edit</a>"+" | "+ "<a onclick="+ch+"return ConfirmChoice()"+ ch +" href=frmAgents.aspx?Cmd=DELETE&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Delete</a>" %>'></asp:Label>
  37. </ItemTemplate>
  38. <ItemStyle HorizontalAlign="Center" />
  39. <HeaderStyle HorizontalAlign="Center" />
  40. </asp:TemplateField>
  41. </Columns>
  42. <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  43. <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  44. <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  45. <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  46. <EditRowStyle BackColor="#2461BF" HorizontalAlign="Center"
  47. VerticalAlign="Middle" Wrap="True" />
  48. <AlternatingRowStyle BackColor="White" />
  49. </asp:GridView>
  50. <asp:SqlDataSource ID="SqlDataSource1" runat="server"
  51. ConnectionString="<%$ ConnectionStrings:sitehealthConnectionString %>"
  52.  
  53. SelectCommand="SELECT [ServerID], [HostName], [MachineType], [Kernel], [SerialNo], [PrimaryIP] FROM [T_Servers]"
  54. onselecting="SqlDataSource1_Selecting">
  55. </asp:SqlDataSource>
  56. </p>
  57.  
  58. <p>
  59. &nbsp;</p>
  60. <p>
  61. Site Health Service Status:
  62. <asp:Label ID="serviceStatusLabel" runat="server" Font-Bold="True" Text="Label"
  63. ToolTip="If the service isn't started this application wont work"></asp:Label>
  64. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  65. <asp:Button ID="StopService" runat="server" Text="Stop Service"
  66. onclick="StopService_Click1" />
  67. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  68. <asp:Button ID="StartService" runat="server" Text="Start Service"
  69. onclick="StartService_Click1" />
  70. </p>
  71. <p>
  72. &nbsp;</p>
  73. <p>
  74. Page Refresh Time
  75. <asp:DropDownList ID="RefreshTime" runat="server" AppendDataBoundItems="True"
  76. AutoPostBack="True" onselectedindexchanged="RefreshTime_SelectedIndexChanged"
  77. ToolTip="Sets the refresh time of the current page">
  78. <asp:ListItem Value="10">10 Seconds</asp:ListItem>
  79. <asp:ListItem Value="30">30 Seconds</asp:ListItem>
  80. <asp:ListItem Value="60">60 Seconds</asp:ListItem>
  81. <asp:ListItem Value="300">5 Minutes</asp:ListItem>
  82. <asp:ListItem Value="600">10 Minutes</asp:ListItem>
  83. <asp:ListItem Value="3">3 seconds</asp:ListItem>
  84. <asp:ListItem Value="5">5 seconds</asp:ListItem>
  85. </asp:DropDownList>
  86. &nbsp;
  87. <asp:Label ID="fresh" runat="server" Text="Label"></asp:Label>
  88. </p>
  89. <p>
  90. &nbsp;</p>
  91. <p>
  92. <asp:SqlDataSource ID="SqlDataSource2" runat="server"
  93. ConnectionString="<%$ ConnectionStrings:sitehealthConnectionString %>"
  94. DatasourceMode="DataSet"
  95. onselecting="SqlDataSource2_Selecting"
  96. SelectCommand="SELECT COUNT(*) FROM T_Servers"></asp:SqlDataSource>
  97. </p>
  98. </asp:Content>
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Asp.net javascript confirmation box not cancelling
Next Thread in ASP.NET Forum Timeline: Update Web.config from windows application





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC