turns out there was a database query that runs to validate the server is in an admin group after the button is set, atm the query is returning null so this is why the button is being disabled. Thanks for all the advice/help
pmcm
Posts
-
ASP Button not displaying on Windows 2012 Server -
ASP Button not displaying on Windows 2012 Serverbesides debugging the application and stepping through the code that sets the buttons values what else can I do? In my test the code is hitting this case within the switch:
case "Stopped":
e.Row.Cells[2].BackColor = System.Drawing.Color.OrangeRed;
e.Row.Cells[2].ForeColor = System.Drawing.Color.White;
((Button)e.Row.Cells[7].Controls[1]).Text = "Start";
((Button)e.Row.Cells[7].Controls[1]).ForeColor = System.Drawing.Color.Green;
((Button)e.Row.Cells[7].Controls[1]).CommandArgument = entry["Site"] as string + "|" + entry["Description"] as string;
break;but when to code has finished running and the webpage is displayed, here's the source of the webpage:
[Description](javascript:__doPostBack\('UcSites1$GridView1','Sort$Description'\))[Identifier](javascript:__doPostBack\('UcSites1$GridView1','Sort$Identifier'\))[State](javascript:__doPostBack\('UcSites1$GridView1','Sort$State'\))[Host Header Value](javascript:__doPostBack\('UcSites1$GridView1','Sort$HostHeaderValue'\))[IP Address](javascript:__doPostBack\('UcSites1$GridView1','Sort$IPAddress'\))[Port](javascript:__doPostBack\('UcSites1$GridView1','Sort$Port'\))[SSL Port](javascript:__doPostBack\('UcSites1$GridView1','Sort$SSLPort'\))Button Default Web Site1Stopped 80
You can see the cell[2] is updated with an OrangeRed background and white text. I've followed the code the whole way through and there is no where else it is manipulated, very strange. What this application does is it reviews the status of Sites setup in IIS and displays their status in the gridview and if the site status = stopped the button should display 'start' and so on.
-
ASP Button not displaying on Windows 2012 ServerI've an application that displays information in a gridview:
the status of the button is set
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView entry = e.Row.DataItem as DataRowView;
if (entry != null)
{
switch (entry["State"] as string)
{
case "Stopped":
e.Row.Cells[2].BackColor = System.Drawing.Color.OrangeRed;
e.Row.Cells[2].ForeColor = System.Drawing.Color.White;
((Button)e.Row.Cells[7].Controls[ -
Error when upgrading project .net Framework from 3.5 to 4.5I'm getting the following error after I upgraded my solution's .Net Framework from 3.5 to 4.5: "Error 6 Custom tool error: Failed to generate code. Failed to generate code. Exception of type 'System.Data.Design.InternalException' was thrown. Exception of type 'System.Data.Design.InternalException' was thrown." in this .xsd file:
-
display contents of GAC 3.5 and 4.5 versionsI've a web tool that currently output the contents of the GAC to a user. The Tool is built with .Net 3.5 the majority of the servers have .Net 3.5 framework installed. But some servers have been updated with .Net 4.5 framework and now the users want to view the contents of this GAC which is in a different location to 3.5 from C:\Windows\assembly to C:\Windows\Microsoft.NET\assembly. At present the class used to decipher the GAC contents is based on Microsoft KB Article KB317540. This is 3.5 specific. How can I update my app to display the 4.5 GAC contents where applicable?
-
delaying data load for a repeater on web formHi All, i'm after a bit of advice on the homepage of my app there is one particular section (Repeater) that queries the DB to provide a high level overview of the latest version of an application. Loading the data into this repeater is having an impact on the load time of the homepage so my thought on this is to is to add a checkbox to the page and on the initial page load do not populate the repeater but if the user checks the checkbox to display the data then go an query the DB to populate the repeater. Aside from only loading this data on request what other way could I control the populating of this repeater so that is not impacting performance?
-
Rollback DB changes through the UI - requesting adviceHi I've an application with an admin section, for example a dropdown list is poopulated with cities but if the user was to delete some records through the UI, verify their actions in the dropdown and then decided they wanted to undo their change. What would be the best way to enable rollback functionality like this?
-
Binding combo-box to Entity Data Modelthank you for the reply, I have managed to get it working by changing the code behind my form to be:
List companies = dal.GetCompanyList1();
cmbCompanyNameSearch.DataSource = companies;
cmbCompanyNameSearch.DisplayMember = "CompanyName";
cmbCompanyNameSearch.ValueMember = "CompanyID";and renaming my DataAccessLayer method to GetCompanyList1
-
Binding combo-box to Entity Data ModelHi, I'm trying to keep my data access code separate from the code behind my form. What I am trying to do is populate my combo-box with a list of CompanyNames here's how I'm trying to bind this combo-box to my Companies entity to retrieve the CompanyName:
private void frmMain_Load(object sender, EventArgs e)
{
dal = new DataAccessLayer();cmbCompanyNameSearch.DataSource = dal.GetcmbCompanyList();
}
and here's the method in my DataAccessLayer:
public List<Companies> GetcmbCompanyList()
{
// Check we have an ObjectContext
if (entities == null) entities = new CompanySecretaryEntities();// Create a query from the entityset ObjectQuery<Companies> companies = entities.Companies; companies.MergeOption = MergeOption.AppendOnly; // Define the query var query = from c in entities.Companies select c.CompanyName; // Execute the query List<Companies> results = query.ToList(); // Return the results in a List return results;
}
This is giving me the following error: Error 1 Cannot implicitly convert type 'System.Collections.Generic.List<string>' to 'System.Collections.Generic.List<CompanySecretary.Companies Can anyone point me in the correct direction? I know if I change select c.CompanyName; to be select c; removes the error message but I only want to select c.CompanyName in this instance
-
Winform linked to Entity Data ModelHi I've created a windows app for a user to manage company info. I have a main form with fields(textboxes, datagrids, dates, comboboxes etc) to be completed for new companies. For any existing companies I'd like to add a search box to my main form and I suppose on the click event of a Search button I'd like to prefill the form with all the relevant data. Can anyone point in the direction to any tutorials, links that show me how to do this? I'm relatively new to C# and this is my first project using an EDM. Thanks for your help
-
Email button in Datagridviewthank you for the link, I've bookmarked it for future reference
-
Email button in Datagridviewthanks this helped me out
-
Email button in Datagridviewhi everyone, i've a form with a datagridview containing Name, and email address field. I've added another button column to this grid and on the click event of this button I'd like to concantenate the mailto: process and the email address field. Something like this:
if (this.dgvPresenters.Columns[e.ColumnIndex] is DataGridViewButtonColumn)
{
Process.Start("mailto + '"(this.dgvPresenters[e.ColumnIndex,e.RowIndex].Value.ToString())"'+"); }the email field in the DB is saved as name@company.com - hope this makes sense. Thank you
-
help rewriting this bit of codethe application itself is a 1 page web app to allow a user to manage product/Salesman data in a gridview, nothing to special. I could rewrite the above bit of code t populate a dataset and use that to populate the ddlSalesman, I'm just wondering how I would do it using the exisiting List that I have created?
-
help rewriting this bit of codehi everyone I'm trying to not only make my cod emore readable but also reusable so i'm trying to rewrite the following bit of logic;
protected void Page_Load(object sender, EventArgs e)
{
clsDB = new clsDB();
GetSalesmanDesc();if (!IsPostBack) Populate\_ddlCustomers(); } public void GetSalesmanDesc() { salesmanList = new List(); try { salesmanList = new List(); con = new SqlConnection(strConnString); SqlCommand com; com = new SqlCommand(); com.CommandType = CommandType.StoredProcedure; com.CommandText = "GetSalesmanDesc"; com.CommandTimeout = 300; // try for 5 mins com.Connection = con; com.Connection.Open(); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { Salesman salesman = new Salesman(); salesman.SalesmanID = reader\["SalesmanCode"\] as String; salesman.SalesmanName = reader\["Salesman"\] as String; salesmanList.Add(salesman); } } catch (System.Data.SqlClient.SqlException ex) { string msg = "Fetch Error:"; msg += ex.Message; throw new Exception(msg); } finally { con.Close(); } }
I would really like to try and keep the SQL actions separate from my main procedure so instead of the above I am tryign something like this:
public void GetSalesmanDesc()
{
salesmanList = new List();
clsDB.getSalesmanDesc();
}the code in clsDB.getSalesmanDesc() is:
public bool getSalesmanDesc() { com = new SqlCommand(); com.CommandTimeout = 300; // try for 5 mins com.CommandText = "GetSalesmanDesc"; com.Connection = sqlCon; com.CommandType = CommandType.StoredProcedure; da.SelectCommand = com; try { sqlCon.Open(); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) {
-
The type or namespace name 'Excel' could not be foundI fixed this issue by doing:
using Microsoft.Office.Interop;
using Excel = Microsoft.Office.Interop.Excel;
using Word = Microsoft.Office.Interop.Word; -
The type or namespace name 'Excel' could not be foundI've added the MS Excel 14.0 Object Library reference (COM Tab), Richard the link that you have recommended is one that I have already followed but I was still getting the error.
-
The type or namespace name 'Excel' could not be foundyour suggestion worked but instead of doing that every time throughout my code I've set this up:
using Excel = Microsoft.Office.Interop.Excel;
any idea why my project doesn't seem to be picking up the references that I added? Thanks
-
The type or namespace name 'Excel' could not be foundHi everyone, I'm working in VS2010 and trying to create an app that interacts with Excel. I've added The MS Excel 14.0 Object Library reference (COM Tab) and at the top of my code I have the following:
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.Excel;
using Microsoft.Office.Interop.Word;I've tried to do:
var x1 = new Excel.Application();
and I get the error. My project is .Net framework 4. I've tried to find an answer on Google and did what was suggested on a few other forums but still this is not working for me anyone any ideas why?
-
Dropdown list to populate a gridviewhere's the answer to my question; I didn't have the OnSelectedIndexChanged="ddlCustomers_SelectedIndexChanged" property set in the ASP properties of the drop down list
Code:
<asp:DropDownList ID="ddlCustomers" runat="server"
Height="17px" Width="285px"
ToolTip="Customers"
AppendDataBoundItems="true"
OnSelectedIndexChanged="ddlCustomers_SelectedIndexChanged">
<asp:ListItem >Please Select a Customer</asp:ListItem>
</asp:DropDownList>