|
Norris Chappell wrote: Doe John 176.0000 1.0000 165.0000 0.9400 04/01/2015 Which one's ActualFTE among these, and what's with the Label lst ?
You have just been Sharapova'd.
|
|
|
|
|
Sorry for the delayed reply, I don't check the inbox linked with this account too often. I think you might have resolved this issue already, but -
If the ActualFTE is 0.7300, as you have mentioned in the email, the row should have been highlighted in Orange color? If that's "not" the case, are you sure you still have the else if condition < .75M in place and it's really not < .075 by any chance (from what you have mentioned in your original post)?
Also, can you check what you are getting from Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualFTE")) using immediate window/quick watch and a debug point?
You have just been Sharapova'd.
|
|
|
|
|
protected void gvCATW_RowDataBound(object sender, GridViewRowEventArgs e)
{
for (int i = 0; i <= gvCATW.Rows.Count - 1; i++)
{
if (Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualFTE")) < .75M)
{
e.Row.ForeColor = System.Drawing.Color.Orange;
}
else if (Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualFTE")) > 1.25M)
{
e.Row.ForeColor = System.Drawing.Color.Red;
}
The conditions are working properly. It is the fact that the very first record is not changing to Orange even though it is < .075
|
|
|
|
|
There's no need to loop over all the rows - the RowDataBound event will fire for each row.
Try changing your code to:
protected void gvCATW_RowDataBound(object sender, GridViewRowEventArgs e)
{
decimal actualFTE = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualFTE"));
if (actualFTE < .75M)
{
e.Row.ForeColor = System.Drawing.Color.Orange;
}
else if (actualFTE > 1.25M)
{
e.Row.ForeColor = System.Drawing.Color.Red;
}
}
If it still doesn't work, check the HTML source to see what's rendered for the first row. You might want to add the ActualFTE to the row as a data- attribute, to make sure the value is what you're expecting:
decimal actualFTE = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualFTE"));
e.Row.Attributes.Add("data-actual-fte", actualFTE.ToString());
...
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks. That worked. Is now doing what they want.
|
|
|
|
|
I'm working on a WPF/C# app.
Background
First, all my user controls in WPF inherit from a base control:
public interface IControl
{
void Load();
void Cleanup();
}
and
public abstract class _UserControlBase : UserControl, INotifyPropertyChanged, IControl
{
public new abstract bool IsEnabled { get; set; }
public abstract void Load();
public abstract void Cleanup();
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Next, I created a control called ConnectionView which inherits from both _UserControlBase and its own interface:
public interface IConnectionView
{
event EventHandler<ConnectedToDeviceEventArgs> ConnectedToDevice;
}
and
public partial class ConnectionView : _UserControlBase, IConnectionView
{
#region Event Declations
public event EventHandler<ConnectedToDeviceEventArgs> ConnectedToDevice;
#endregion
.
.
.
}
Finally, in my MainWindowView I have a content presenter bound to the property CurrentView and it's loaded like this:
public class MainWindowViewModel : _ViewModelBase
{
private IControl _CurrentView;
public IControl CurrentView
{
get { return _CurrentView; }
set
{
if (_CurrentView != value)
{
_CurrentView = value;
RaisePropertyChanged("CurrentView");
}
}
}
public MainWindowViewModel()
{
loadView(AppMode.Discover);
}
private void loadView(AppMode mode)
{
if (CurrentView != null)
{
CurrentView.Cleanup();
}
switch (mode)
{
case AppMode.Connected:
break;
case AppMode.Discover:
CurrentView = new ConnectionView();
CurrentView.Load();
break;
}
}
}
The Problem
Since the CurrentView is based off _UserControlBase, the ConnectedToDevice event isn't available.
How do I subscribe to the ConnectionView's ConnectedToDevice event in the main window?
If it's not broken, fix it until it is
|
|
|
|
|
If you're subscribing to the event when you create the control, you just need a local variable of the correct type:
case AppMode.Discover:
var view = new ConnectionView();
view.ConnectedToDevice += YourEventHandler;
CurrentView = view;
CurrentView.Load();
break;
If you want to subscribe at some other point, the as operator would work:
var connectionView = CurrentView as IConnectionView;
if (connectionView != null)
{
connectionView.ConnectedToDevice += YourEventHandler;
}
NB: There's a subtle race-condition in your RaisePropertyChanged method. It's possible that the last subscriber could be removed between the not-null check and the invocation. The simplest fix is to copy the delegate to a local variable at the start:
protected void RaisePropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: If you're subscribing to the event when you create the control, you just need a local variable of the correct type:
case AppMode.Discover:
var view = new ConnectionView();
view.ConnectedToDevice += YourEventHandler;
CurrentView = view;
CurrentView.Load();
break;
That did it!
Thanks!
If it's not broken, fix it until it is
|
|
|
|
|
I have a C# ASP Web project where I’m required to produce a 200+ page PDF to eventually download and open on the browser. I have no experience in building a PDF file, and I was wondering if someone could point me in the right direction. I need a component / product / method that would be able to handle such a large report.
Thanks in advance
|
|
|
|
|
I've had fair success with this[^] option.
|
|
|
|
|
Thanks for your response, but can it handle a 200 page report.
|
|
|
|
|
That really depends on how complex you're going to make your report. The more graphics, sections, etc, the heavier the memory demand on it will be.
|
|
|
|
|
I'm looking for a complete proficient solution regardless of price, one that could print up to 500 pages of text let's say and perhaps some charts.
|
|
|
|
|
If you're prepared to pay then, this[^] is the one I use. It's high performance, and very scalable.
|
|
|
|
|
Hello,
I have searched for demo project for Stack Exchange Redis in .NetFramework 4.0 C# but I didn't find yet.
Please share if possible.
Need: I want to use this in caching for storing just key, value pair. I have used system.caching but it destroy cache after service restart.
So I have used first Service Stack Redis but it have limitation of 6000 request per day and my project have almost 282984 requests per day.
So I switched to Stack Exchange Redis. I have made sample project and it works fine in my local machine. But when I deploy project on staging environment gives below error:
It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. UnableToResolvePhysicalConnection on PING
StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. UnableToResolvePhysicalConnection on PING
at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Func`1 multiplexerFactory, TextWriter log)
at StackExchange.Redis.ConnectionMultiplexer.Connect(String configuration, TextWriter log)
at StackExchangeApplication.Source.Service.RedisService..ctor()
at StackExchangeApplication.Source.Service.RedisService.get_GetInstance()
at StackExchangeApplication.RedisHelper.GetStringValue(GetValueRequestMessage requestMessage)
Here is my code:
public class RedisService
{
public static ConnectionMultiplexer _connection;
public static IDatabase _redisDatabase;
static RedisService()
{
_connection = ConnectionMultiplexer.Connect("localhost");
_redisDatabase = _connection.GetDatabase();
}
public void AddStringKeyValue(string key, string value, int expireInMinute)
{
bool result = _redisDatabase.StringSet(key, value, TimeSpan.FromMinutes(expireInMinute), When.Always,
CommandFlags.None);
if (!result)
{
throw new Exception("Failed To add key value in Redis server Key : " + key + ", Value : " + value);
}
}
public string GetStringValue(string key)
{
string value = _redisDatabase.StringGet(key);
return value;
}
}
Please help if anyone tried this I am finding out solution from last 3 days .
Thanks in advance!
|
|
|
|
|
Just a wild guess (I have no idea what redis is) you are setting your ConnectionMultiplexer to localhost and deploying to a server which does not have localhost. You need to give the staging server the correct address to your redis server
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have same redis installed on each environment.
Connection sring was not actually the problem.
I resolved this issue using adding default port of Redis to firewall.
Thanks for answering!
|
|
|
|
|
hello
i want fill a text box or richtextbox or combobox with datagridview column content
this is my code
static public void refresh(DataGridView datagridview)
{
try
{
if (Connection.State == ConnectionState.Closed)
Connection.Open();
MySqlDataAdapter dataadapter = new MySqlDataAdapter("SELECT * FROM suTable", Connection);
DataTable dt = new DataTable();
dataadapter.Fill(dt);
datagridview.DataSource = dt;
}
catch (MySqlException Exception)
{
MessageBox.Show(Exception.ToString());
}
finally
{
Connection.Close();
}
|
|
|
|
|
Hang on a moment...
Yesterday you said:
yes i can get it and send to richtextbox When I asked you:
Well, you know how to get the contents of a DGV column, I assume? So you have forgotten overnight?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
we work in group and my partner said i can do it now got problem withe getting dgv column content and send it to a text box
can u help me bro
|
|
|
|
|
So why not use the code that "your partner" was using yesterday? Why is it better to ask us?
And why the heck do you have multiple people using the same CP account?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
this is the code but working
while(dt.rows.count>0)
{
txt1.text=dt.rows[0]["columnname"].tostring();
}
|
|
|
|
|
So, if it's working why are you asking us?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
1) Don't shout.
2) Make your mind up:
Member 11579870 wrote: this is the code but working/blockquote>
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|