|
If you had done little search on internet, you would have found the answer.
Here is your solution.
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Good Day All
I have a Class that is defined like this
namespace EAVV
{
public class EAV
{
private string _Attribute;
private string _Value;
public string Attribute
{
get
{
return _Attribute;
}
set
{
_Attribute = value;
}
}
public string Value
{
get
{
return _Value;
}
set
{
_Value = value;
}
}
public EAV(string AttributeEA, string ValueEA)
{
this._Attribute = AttributeEA;
this._Value = ValueEA;
}
public EAV()
{
}
}
}
And I have another one to process this like this
namespace EAVV
{
public class EAVProcess
{
public List<EAV> GetRecords(List<string> ParentRecords,List<string> ChildRecords)
{
List<EAV> Final= new List<EAV>();
for (int i = 0; i < ParentRecords.Count; i++)
{
for (int J = 0; J < ChildRecords.Count; J++)
{
Final.Add(new EAV(ParentRecords[i], ChildRecords[J]));
}
}
return Final;
}
public EAVProcess()
{
}
}
}
And as you can see this will return a list. So I am binding my Grid(Telerik) which is the same as binding the normal asp.net grid like this
RadGrid1.DataSource = EAVobj.GetRecords(ParentRecordsRow, ChildRecordsField);
RadGrid1.DataBind();
And I get the Following Data
http://www.telerik.com/ClientsFiles/212012_grid-hierachy.JPG[^]
from the Image, You can see there is an Attribute Column and there is a Value Column, Now what i want to do is that i want to have only one Country and one Event in the Attribute and the Values must be nested underneath each other in a Grid, so basically i need a nested View and the Attribute is the parent and the Values will be grouped according to their parent.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
If I am not mistaking this may solve your purpose
namespace EAVV
{
public class EAVProcess
{
public List<EAV> GetRecords(List<string> ParentRecords,List<string> ChildRecords)
{
List<EAV> Final= new List<EAV>();
for (int i = 0; i < ParentRecords.Count; i++)
{
--Put a check for child records exists and add
Final.Add(new EAV(ParentRecords[i], ChildRecords[0]));
--Start looping from 2nd J = 1 instead of 0
for (int J = 1; J < ChildRecords.Count; J++)
{
--remove ParentRecords[i]
Final.Add(new EAV("", ChildRecords[J]));
}
}
return Final;
}
public EAVProcess()
{
}
}
}
|
|
|
|
|
This is wonderful
Thank you very much you are a star
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
I wrote some simple class with 3 fields ( lets say that the fields are RGB ).
and i have some UI to define the value of those fields.
The UI is on class A and the class with the RGB values is in other class.
Now, I want to do binding between those two classes -
I mean that i want to do 'auto update' if the value in the UI change - and this 'auto update' will set the field value.
How can i do it ?
Thanks.
|
|
|
|
|
In your RGB class:
Inherit iNotifyPropertyChanged
create the Notifychange event
Create the properties for RGB
Implement the InotifyChanged in the setter
In you UI
Instantiate the RGB class
add a databinging to the controls binding to the rgb properties in that class
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi
I want to problematically determine if mysql is installed on my machine or not.
Please help
|
|
|
|
|
I'd try WMI and look for the MySQL service.
|
|
|
|
|
|
It's something like:
System.Management.ManagementScope oMs = new System.Management.ManagementScope(@"\\localhost");
oMs.Path.NamespacePath = @"root\cimv2";
string query = "select * From Win32_Service Where Name Like \"%mysql%\"";
System.Management.ObjectQuery oQuery = new System.Management.ObjectQuery(query);
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
foreach (ManagementObject oReturn in oReturnCollection)
{
foreach (PropertyData propertyData in oReturn.Properties)
{
txtResult.Text += string.Format("{0}: {1}\r\n", propertyData.Name, propertyData.Value);
}
}
This writes all information available on all services containing "mysql" in their name into textbox "txtResult".
Note also the "State" and "Started" properties.
|
|
|
|
|
sumit7034 wrote: I want to problematically determine...
really?
it could be installed but not running, so maybe it is better to check for a process, with a name that contains "mysql"; the exact name may depend on the implementation, my XAMPP package launches a "mysqld" process.
See Process.GetProcessesByName()
|
|
|
|
|
Is it possible Inherit an internal class to a public class in C# class library
|
|
|
|
|
No. You can reduce accessibility, but you cannot increase it. Otherwise, what would be the point?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
No. Why don't you try it?
Visual Studio will give you an "Inconsistent accessibility: base class xyz2 is less accessible than class xyz1" error when both classes are in the same source file.
|
|
|
|
|
thanx,
yup, i tried and got error msg.
Then pls let me know, what will be the use of internal class in class library(any real time eg)
mean signification reason of using internal class in class library
|
|
|
|
|
a class can be useful without being inherited; so could be a nested class, however an internal one is usable in several classes within the same source file.
|
|
|
|
|
|
That's not strictly true, Luc: internal classes are available within the same namespace rather than file. I frequently use internal for sub forms which are useful within the context of my public classes in a namespace, but which would be confusing or useless outside.
BTW: How did/is the chess go/going?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
you are right, some people may put more than one namespace in a file, I know I wouldn't.
BTW: it is much too early to tell, preliminary battles yielded a typical 50%, however it is a 9-day open encounter according to the Swiss[^] pairing system.
|
|
|
|
|
Luc Pattyn wrote: some people may put more than one namespace in a file
Yeuch! No, no, no! Don't do it!
One class, one file.
One namespace, many files.
Internal is not restricted to file, just to namespace.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
|
Assembly AND namespace. You cannot use someone else's internal classes by simply adding your own version of that namespace in your own assembly. The whole idea is to make it so that ONLY the guy who wrote the original method can decide how to use it. Not so that only people who know what namespace it is can use it. This is basic .net 101, and has been true since version 1.0.
edit: one more qualification, this applies to 'internal' classes that do not specify the 'internal' modifier. If you specify the 'internal' modifier you can use them within any namespace as long as you reference the correct one, but STILL only within the original assembly. So for example a class declared as
class MyClass(){ } can only be referenced in its original namespace and assembly.
However, one declared as
internal class MyClass() { } can be referenced by anything in the assembly.
|
|
|
|
|
Hang on, I've just realised - by file you are referring to Assembly (DLL/EXE) where I am referring to source. Oops!
But I agree - one assembly, one namespace.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
you should have left it at that.
I did say source file, not assembly.
|
|
|
|
|
Internal class is visible only inside assembly. You can use it to implement functionality, that is required by your assembly, but shouldn't be accessible outside the assembly.
The real life example you say...
Let's say your application has an assembly for accessing database. You have classes with methods that perform some operations on database (insert, update, delete, select). Under the hood you use Entity Framework, but to assure, that database access is performed only with your classes, you set Entity Framework context class as internal. That provides you with cleaner code and strict separation of layers - higher layers don't know what mechanism you use for accessing database... and honestly, they shouldn't care.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|