|
Mark:
Yes, I have shutdown VS and restarted it.
I'm sorry - it will not happen again.
Luc:
Yes - I tried removing all binary files, all bin/obj folders, etc.
|
|
|
|
|
Do you have a clean development environment in a VM? If so, copy the source-files and rebuild there. If no, you might as well create such an environment while waiting for a decent answer that actually solves the problem.
I are Troll
|
|
|
|
|
I'm not sure I get what you mean. Could you please elabroate?
|
|
|
|
|
You could install Windows and Visual Studio in a Virtual Machine, using Virtual PC 2007[^] for example. That way you'd always have a clean environment
As is now, it would be guessing at the problem. Did you by any chance register any of the dll's as COM-controls?
I are Troll
|
|
|
|
|
That seems a bit much work for that - I think I'd rather keep trying things. Thanks for the tip, though.
I didn't register them as COM, no.
|
|
|
|
|
Is the old version in the GAC?
Oh, you said not.
|
|
|
|
|
Hi,
I have the following linq code within my app
var results = (from t in query
where t.ProjectID == new Guid(this.Session["ProjectID"].ToString())
orderby t.Number ascending
select new
{
ID = t.ID,
Tag = t.Number,
Description = t.Description,
SubSystems = GeneralHelper.TagSubSystems(t),
Module = t.Area.Module.Name,
Discipline = t.Discipline.Name,
ITRs = GeneralHelper.TagITRsHTML(t)
});
I want to pass the query result to another function to handle my paging. I currently have another function defined like this
public void BindGridData(IQueryable result)
{
gridView.DataSource = result;
gridView.DataBind();
}
It works like this, but the problem is I cannot do "take" or "skip" on "result" because it's declared as IQueryable. Is there a work around to handle this?
Thanks
|
|
|
|
|
convert the linq result to list
var results = (from t in query
where t.ProjectID == new Guid(this.Session["ProjectID"].ToString())
orderby t.Number ascending
select new
{
ID = t.ID,
Tag = t.Number,
Description = t.Description,
SubSystems = GeneralHelper.TagSubSystems(t),
Module = t.Area.Module.Name,
Discipline = t.Discipline.Name,
ITRs = GeneralHelper.TagITRsHTML(t)
}).ToList();
|
|
|
|
|
If I convert it to list, then how do I define the function that takes the query result?
|
|
|
|
|
public void BindGridData(IEnumerable result)
{
gridView.DataSource = result;
gridView.DataBind();
}
Also note the use of the pre tags to properly format the code snippet
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
IEnumerable requires an argument,
IEnumerable result
any idea what argument would work?
|
|
|
|
|
Create a structure to represent your query results, instead of using anonymous types. Then you know what kind of IEnumerable it is.
Alternatively, make your Bind function generic, like so:
public void BindGridData<T>(IEnumerable<T> result)
{
gridView.DataSource = result;
gridView.DataBind();
}
|
|
|
|
|
|
Although I agree a concrete type is better for readability and good design it isn't necessary in order to pass the query to a method.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
the reason i didnt define a concrete type is because the function will be accepting queries from different classes
|
|
|
|
|
Ok, then the second solution is best
Oh, and you don't need to do a ToList() if you're going that route. Linq results are all IEnumerable.
|
|
|
|
|
Using generics, as Ian has suggested, doesn't preclude you from doing that. You would just need to create the class/struct for each query, which from a architectural perspective isn't a bad idea. However, if you have many different queries that are possible then perhaps you need to improve your design, one size fits all implementation are very difficult to maintain.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
One more thing,
lets say I store "result" in session variable like this
public void BindGridData<t>(IEnumerable<t> result)
{
Session["result"] = result;
gridView.DataSource = result;
gridView.DataBind();
}
and then I want to call this function within another event, how do I call it? how do I cast Session["result"]?
Thanks
|
|
|
|
|
First of all don't store it in session state. Remember this is the result of your query, not the query itself, and could be very large.
It's also quite clear how to cast it. It is being passed into your method as an IEnumerable, guess what it should be cast as?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
IEnumerable<T> requires a type but IEnumerable does not.
I know the language. I've read a book. - _Madmatt
modified on Tuesday, August 31, 2010 12:12 PM
|
|
|
|
|
|
Sorry, the brackets didn't render. Fix it
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi all, I'm hoping someone could shed some light here please.
I have a ToolStripPanel on my form with a few ToolStrip s which in turn each have a few ToolStripButton s.
I wrote an event handler for the MouseEnter and MouseLeave events of all of these buttons so that I can change the image depending on whether the mouse is over the button or not. Basically, I have an animated gif which I'm showing when the mouse is over the button and a static image when it's not.
It works but it has a little glitch. Every time the image of a button changes, the size of the button changes very briefly. This means that, for a split second, the relevant ToolStrip is resized which has the effect of all the ToolStrips to the right of it being moved left. Like I say, it's only for a split second before everything is restored again (once the button has its new image) but it makes for a very unpleasant visual effect.
Any ideas?
|
|
|
|
|
Hi,
Could you post the code you're using to change the images on your buttons ? This way we would have a better idea on how you handle the stuff.
|
|
|
|
|
Sure, I have two functions:
private void toolStripButton_MouseEnter(object sender, EventArgs e)
{
switch ((sender as ToolStripItem).Name)
{
case "toolStripButton_ViewUser": (sender as ToolStripButton).Image = Properties.Resources.BtnIcon_anim_User; break;
case "toolStripButton_NewUser": (sender as ToolStripButton).Image = Properties.Resources.BtnIcon_anim_UserAdd; break;
case "toolStripButton_ViewItems": (sender as ToolStripButton).Image = Properties.Resources.BtnIcon_anim_Item; break;
case "toolStripButton_NewItems": (sender as ToolStripButton).Image = Properties.Resources.BtnIcon_anim_ItemAdd; break;
... etc.
}
}
private void toolStripButton_MouseLeave(object sender, EventArgs e)
{
switch ((sender as ToolStripItem).Name)
{
case "toolStripButton_ViewUser": (sender as ToolStripButton).Image = Properties.Resources.BtnIcon_User; break;
case "toolStripButton_NewUser": (sender as ToolStripButton).Image = Properties.Resources.BtnIcon_UserAdd; break;
case "toolStripButton_ViewItems": (sender as ToolStripButton).Image = Properties.Resources.BtnIcon_Item; break;
case "toolStripButton_NewItems": (sender as ToolStripButton).Image = Properties.Resources.BtnIcon_ItemAdd; break;
... etc.
}
}
The MouseEnter and MouseLeave events of all the buttons are handled by these two functions.
|
|
|
|