|
In my application, there is a datagrid control and there are several columns on it. You know that datagrid control applies sorting data but I want to sort as multiple columns.
For example, two columns are date and username. Firstly datagrid sort by date and after sort by username. Sorting priority of date greater than username.
Date UserName
12.03.07 Mehmet
12.01.06 John
24.05.08 Michael
24.05.08 Anna
12.03.07 Becham
Sorting by only date
Date UserName
12.01.06 John
12.03.07 Mehmet
12.03.07 Becham
24.05.08 Michael
24.05.08 Anna
Sorting by firstly date and after, by UserName
Date UserName
12.01.06 John
12.03.07 Becham
12.03.07 Mehmet
24.05.08 Anna
24.05.08 Michael
Thanks for your helps.
|
|
|
|
|
I think you can sort by the following codes.
// Only UserName
MyDateGrid.Source = MyDataView;
MyDataGrid.Sort = "UserName";
MyDataGrid.DataBind();
// First UserName than date:
MyDateGrid.Source = MyDataView;
MyDataGrid.Sort = "UserName, theDate";
MyDataGrid.DataBind();
// First date than UserName:
MyDateGrid.Source = MyDataView;
MyDataGrid.Sort = "theDate, UserName";
MyDataGrid.DataBind();
You also need a property that knows what the last sorthing
method was.
private string lastSortCommand = "";
<br />
if(lastSortCommand == "UserName" && currentSortCommand == "theDate")<br />
{<br />
MyDateGrid.Source = MyDataView;<br />
MyDataGrid.Sort = "theDate, UserName";<br />
MyDataGrid.DataBind();<br />
}<br />
else if(lastSortCommand == "theDate" && currentSortCommand == "UserName")<br />
{<br />
MyDateGrid.Source = MyDataView;<br />
MyDataGrid.Sort = "UserName, theDate";<br />
MyDataGrid.DataBind();<br />
}<br />
else<br />
{<br />
MyDateGrid.Source = MyDataView;<br />
MyDataGrid.Sort = currentSortCommand;<br />
MyDataGrid.DataBind();<br />
}<br />
lastSortCommand = currentSortCommand;<br />
Haven't tryed it out, but I'll think i works.
|
|
|
|
|
hi all, i am gonna deploy my windows project using clickonce feature of VS2005
for that i am trying to create an instance to application.deployment
but i left with result, error------ InvalidDeploymentException{"Application identity is not set."}
its also giving click once application is not istalled
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
how can we check whether the click once application is installed or not...Programatically
Thnx in advance,
prashanth
|
|
|
|
|
Try this [^]forum set of questions / responses.
|
|
|
|
|
How to register COM object when created in VS2005 Express ?
I've tried checking Register for COM interop in Project Properties->Build , i've tried Regasm.exe utility and still when I try Add Refrence -> COM , that object is not there...
|
|
|
|
|
Now when I checked warnings, there is a Warning: "C:\Documents and Settings\stefanz\My Documents\Visual Studio 2005\Projects\Test45_COM\bin\Release\Test45_COM.dll" does not contain any types that can be registered for COM Interop. I've done everything according to Creating simple COM objects using interop
|
|
|
|
|
Hey Guys,
I've got a asp.net web application. Its a simple application which connects to a SQL Server 2005 Mobile database. I would now like to write a windows application which will wrap this asp.net web application and allow it to be executed normally.
I was thinking of using the in-build webdev server somehow in the windows application. Then, add the webdev.exe to the setup project of the windows app.
Can this be done? If so, how would I go about doing this? I have been searching on google, and will continue to do so. I haven't found a info on this topic.
Thanks.
|
|
|
|
|
Hi!
I am facing problem when inserting large amount of data in XML file. I am using C# 2005. I am using XML file as a replacement of database table. My application stores as many as 100000 or more records in XML file, but it takes too much time in inserting/retrieving these records (almost 1-2 minutes).
I have made such insertion before but at that time structure of each node of XML was very simple with no child nodes, it took 1-2 seconds to insert 100000 records at that time. But now structure of each node is different. Each node contains 5-6 child nodes..
Previously i used MS Access for this purpose but faced same problem so switched to XML, now the data insertion/retrieval time is reduced almost 5 times but my problem is not solved, i want to insert/retrieve 100000 records in maximum 15 seconds.
Please tell me why this problem is occuring, can XML be used as alternative of database? If not then how can i obtain required results...? is there any thing else available for this, other than database and XML...
I put this question in XML/XSD board but i was adviced to consult C# group..
Thanks in advance...
Regards,
Affan Ahmad Toor
|
|
|
|
|
Affan Toor wrote: can XML be used as alternative of database?
No. XML should be used as a data transport mechanism between disparate systems. It should not be used as a database.
Affan Toor wrote: If not then how can i obtain required results...?
Perhaps you database schema was not optimised for what you want to do.
|
|
|
|
|
The amount of records you are trying to process seems a bit excessive for a xml file. I would rather look into something like mysql or sql 2005 express. Both are excelent and should have no trouble in handling a lot of data.
|
|
|
|
|
Although this an old article it may enlighten you http://www.codeproject.com/soap/xmltiming.asp[^]
XML can be used as a small datastore. Note the SMALL, yours is to large for this to be a viable option, as you have found out. I would suggest using SQL Server Express or SQL Server COmpact Edition.
only two letters away from being an asset
|
|
|
|
|
I would certainly suggest you to look at SQL server 2005, At first place it come with XML data type which is much easier. You can do all the operations on SQL server and if required convert it to XML ...
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
hi all ,
I'm working with listview to insert and update data directly into that listview (so you can imagine that user wants to fill data just like using MS.Excel). Oh ya, actually it's a simple purchasing and sales program and I'm using listview to input, update the records of every Item that has been purchased or sold and below the listview, I add one textbox to count the total of purchasing/sales of all items in the listview.
thanx in advance,
dani99el
-- modified at 21:57 Wednesday 11th April, 2007
|
|
|
|
|
Hi there,
Following link explains what you require with example
http://www.c-sharpcorner.com/UploadFile/mgold/ListViewInCSharp11172005021741AM/ListViewInCSharp.aspx
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Thanx for the information jaiprakash ,
Actually, my problem goes up like this :
"I'm working with listview to insert and update data directly into that listview (so you can imagine that user wants to fill data just like using MS.Excel). Oh ya, actually it's a simple purchasing and sales program and I'm using listview to input, update the records of every Item that has been purchased or sold and below the listview, I add one textbox to count the total of purchasing or sales for all items in the listview."
I'd be very grateful if you'd like to share with me. Thanx
|
|
|
|
|
Some hint you will get from following links
http://www.thescripts.com/forum/thread250372.html
http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.beforelabeledit(VS.71).aspx
http://www.c-sharpcorner.com/UploadFile/mgold/HowtoOepnandReadanExcelSpreadsheetinaListViewin.NET11282005034134AM/HowtoOepnandReadanExcelSpreadsheetinaListViewin.NET.aspx
If you want to create a Custom control then following link gives you lots of insight
http://www.codeproject.com/cs/miscctrl/csharpgridcontrol.asp
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
hi ,
thanks a lot for the hints
Regards,
Daniel
|
|
|
|
|
No problem friend,
Cheers !!!
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
bonjour
je developpe un programme Drag&Drop en C#
il s'agit d'un "Mainform" qui contient un "StatusBar" ce derniers est constitué des"Panels",mon probléme c'est comment drager ces panels : lorsque je clique sur un panel puis je dispose la soris dans le formulair j'aurai une copie de ce Panel, j'ai essayé avec plusieurs méthodes mais je n'ai pas pu le faire j'ai trouvé un code "Guide to WIN32 Regions
By Paul Watt" sur ce site mais en c++
merci bien de m'avoir aider le plus vite possible
merci
|
|
|
|
|
Wow...
we would luv to help if you try and explain it in simple English
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
I am not sure whether this is a C# or COM issue, but I thought I'd try it here.
We have been building a COM wrapper around a C++ API which needs to be accessible from C#. This seemed to work and run fine as a win32 build with.
Converting to x64 however, despite everything seeming to compile, and being able to access the COM stuff correctly from a c++ application, as soon as we try to add it to C# everything seems to go wrong.
Normally one can click "Add Reference" and then select the type library from the list - and this works fine in x86/win32. However, with the 64bit build, the type library does not appear, and selecting the dll manually gives errors implying that it does not contain any COM components - despite working fine with a c++ project.
Looking in the registry etc. the correct entries seem to be make under HKCR/Typelib/<lib>/win64... exactly as for the win32 case - but I still can't see it from C# in visual studio, or VB for that matter, so I am somewhat at a loss...
Has anyone got any ideas as to what to look for
|
|
|
|
|
I'm just taking a wild stab here but it's probably because C# is by default 32-bit. This page[^] seems to back me up.
[edit]Looks like you can modify the build properties of the C# project for "Any CPU" to host 64 bit processes.[/edit].
Last modified: 1min after originally posted --
|
|
|
|
|
Thanks, but we had already switched the build properties to x64 for all the applicable project options.
On further investigation, it appears to be some form of registration issue, as such COM rather than C#. Using OleView it gives a "Library Not Registered" error, despite it showing up in the TypeLib list, and the registry keys appearing to be set exactly the same as for the 32bit build, except for win64 rather than win32.
The really obscure thing is that when I cheat and change the win64s to win32s in the registry it all seems to work despite the registry keys being blatantly wrong :-s, as it should be able to support both win32 and win64 simultaneously...
Anyway, I'll probably go and poke some COM people at some point rather than C# people.
|
|
|
|
|
hi every one
how to find the error in xml file.
i am writing a application in that iam using xml file.
but if any error in xml file that exe not working.
i want to know error in xml file while opening my application.
|
|
|
|
|
Load your xml file in an XmlDocument object inside a try-catch block before at he beginning. If you catch an exception close your app or show a message to the user or do whatever you need.
|
|
|
|