|
You're basically asking for someone to teach you how to write interop code, or to write the interop for you. Why don't you look at the C# port of this here[^]? See if that's any more help for you.
|
|
|
|
|
Hi, everyone i am beginner in asp.net(c#) and want to know what thing we should know for getting job in this field now day, please help me we want job.
|
|
|
|
|
|
As Richard has said, we can't really help you that much.
And a lot of it will depend on local conditions.
It might be worth asking othesr in the same country - at least they know what is "hot" locally and what helped them to get a job.
We do have a General Indian Topics[^] forum, which would at least address other Indian nationals directly?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
The first record is displaying, I only wanted to show rows with more 1.25 and less .075.
Doe John 176.0000 1.0000 165.0000 0.9400 04/01/2015
This first row is the culprit.
What is wrong with my code?
protected void gvCATW_RowDataBound(object sender, GridViewRowEventArgs e)
{
for (int i = 0; i <= gvCATW.Rows.Count - 1; i++)
{
Label last = (Label)gvCATW.Rows[i].FindControl("lblActualFTE");
if (Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualFTE")) > 1.25M)
{
e.Row.ForeColor = System.Drawing.Color.Red;
}
else if (Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualFTE")) < .75M)
{
e.Row.ForeColor = System.Drawing.Color.Orange;
}
else
{
e.Row.Visible = false;
}
|
|
|
|
|
If you are using a DataTable, you might want to try setting the RowFilter property of the DefaultView.
|
|
|
|
|
Can you Please explain what that means? I'm now getting all of the rows I want but the very first record is not Yellow which is less than .075. All o the remaining rows are correct.
|
|
|
|
|
If that row is not required, then filter it while getting the data from your data source. So you can avoid all these at code level in C#.
|
|
|
|
|
I changed my sql but it now showing the first row which is < .075 as black not yellow. The rest of the rows are correct.
Bair James S 176.0000 1.0000 128.0000 0.7300 04/01/2015
|
|
|
|
|
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
|
|
|
|