|
Hi
I would like to link ArrayList as datasource to datagridview
I’ve defined the
ArrayList arrList;
arrList = new ArrayList();
//Add data to list
arrList.Add(node_1);
...
arrList.Add(node_n);
dataGridView1.DataSource = arrList;
Adding the link is OK, the problem is that I see all the members of nodes in datagridview and I wish to see only specific members in the grid.
I try to manually add columns to grid and it didn’t help, I see all members of node in datagridview
Please advice
Thanks
Ronen
|
|
|
|
|
maybe you should forget the datasource option and update the grid view as required by looping through the array list. That way you can display what ever you want how you want, much more control that way
|
|
|
|
|
See this is my code same as you want , this works for me correctly:
<br />
grdRequests.Columns.Clear();<br />
<br />
<br />
loanRequests =
grdRequests.DataSource = loanRequests;<br />
grdRequests.DataKeyNames = new string[] { "ID" };<br />
<br />
<br />
<br />
CommandField SelectField = new CommandField();<br />
SelectField.SelectText = "field1";<br />
SelectField.ShowSelectButton = true;<br />
grdRequests.Columns.Add(SelectField);<br />
<br />
<br />
BoundField IDField = new BoundField();<br />
IDField.DataField = "ID";<br />
IDField.HeaderText = "field2";<br />
grdRequests.Columns.Add(IDField);<br />
<br />
...<br />
<br />
<br />
grdRequests.DataBind();<br />
Human knowledge belongs to the world
|
|
|
|
|
The DataGridView will automatically show ALL public properties of your Node class.
So you could do as musefan has suggested, or a possible alternative is to create a new class 'GriddableNode' which holds only the properties you wish to display, then create a list of some sort to use as the datasource for the DataGridView. OR you could edit the columns of the DataGridView, use the SmartTag for the gridview in the designer.
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
I am passing the data of an element inside an xml file into a sql server table with field varchar(max). This datatype is permanent and due to business rule is not allowed to be changed.
The xml file contains something like:
i.e.
<file>
<data>
-----1234------
This is the value for the first item...
</data>
<data>
-----9876------
This is the value for the second item...
</data>
</file>
Notice, there are spaces and carriage returns.
When pulling these data out of the xml file, in the immediate window, I can see "\r\n\r\n" attached to the text where there should be a return.
Problem:
The sql does not take care of these returns, so that when I show these values on the UI, I do not see the carriage returns.
Question:
How do I see the text on the UI as it exacly appears in the xml file ?
Thanks
|
|
|
|
|
Make it CDATA
I are troll
|
|
|
|
|
indeed it has ![CDATA[]] in there already with the data inside []
|
|
|
|
|
In that case I;m obvious not awake, So I'll shut up further and go for a nice cup of black, hot coffee
I are troll
|
|
|
|
|
UI is what? Web or Windows? If its Web then you need to convert spaces to and returns to <br/>
|
|
|
|
|
UI is a third party web front end which I do not have access to the code.
So the only option seems to be when I am placing the xml data into the sql server table.
The xml data in the xml file has carriage return and liine feeds.
In the immediate window (c# app which I use to upload the xml data), I can see \r\n in the text but these signs are not imported into the table field which is of type varchar(max).
Thanks
|
|
|
|
|
arkiboys wrote: I can see \r\n in the text but these signs are not imported into the table field which is of type varchar(max).
Yes they are, its just you dont see them as \r\n - they're non-printing characters so they dont display in the database - but I assure you they're there.
You have 2 options
1) Make the replacement when uploading the data
2) Make the replacement when retrieving data
take your pick.
|
|
|
|
|
In immedia window:
"---- 2008 ----\r\n\r\nsome text here"
In output window:
---- 2008 ----
some text here
in sql server table:
---- 2008 ---- some text here
|
|
|
|
|
Was that supposed to tell me something?
|
|
|
|
|
Sorry,
The idea is to get the same result into the sql field as the one in the output window.
|
|
|
|
|
Hello Friends,
I have a requirement of my application to know when user select a value on crystal report and getting the selected value from crystal report view to my .net application and using that value set data to be drill down.
Kindly help me how can I get the selected value from crystal report view to my application.
Thanks in advance
Regards
|
|
|
|
|
hi,
kindly let me know that, how to add Icon file / JPG file into Cell using DataGridView?
Thankx in advance
(Riaz)
|
|
|
|
|
Use image column.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
hello
having problem trying to unregister remoting channel (.NET 2.0/XP) - error:
<br />
System.Net.Sockets.SocketException : Only one usage of each socket address (protocol/network address/port) is normally permitted<br />
On server side, I created the channel by:
<br />
TcpChannel oTcpChannel = new TcpChannel(AppContext.DefaultRemotingInterfacePort); ChannelServices.RegisterChannel(oTcpChannel, true);<br />
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Util.MyRemoteObj, "TcpRemoteObj", WellKnownObjectMode.Singleton);<br />
Then I try to close and restart channel (as part of application re-initialization rountine - this means process never actually exited and that would be undesirable)
<br />
ChannelServices.UnregisterChannel(oChannel);<br />
TcpChannel oChTcp = (TcpChannel)oChannel; oChTcp.StopListening(null);<br />
I have no clue how to get around this at the moment - I Googled a bit seems like many people are running into this problem but no solution yet. Many suspected OS (or .NET) failed to release socket on UnregisterChannel until application/process exit. But I don't want to exit the app, just want to reinitialize remoting as part of re-init routine.
Any suggestion? Many thanks!
dev
|
|
|
|
|
i am making a program wherein i have a replica of a keyboard. The user will tap any key on the keyboard on what he would like to type. He can select the input language to English,Japanese Hiragana and Japanese Katakana. I'm using Sendkey.Sendwait to send the character tapped by the user to the textbox. My problem is when I select Hiragana or Katakana for the input language and type, sometimes the characters that I type will disappear. It will appear when the user will tap again a key to the keyboard. Please help me...
below is a snippet of my code...this will just display the alphabets...when the letter is tap...
if (m_LastStr!=null && m_LastStr.EndsWith(" ")) // added for the correction asked by anand
{
SendKeys.SendWait(m_LastStr + "\n");
SendKeys.Flush();
m_LastStr = null;
}
if (((Button)sender).Text[0] > 'A' && ((Button)sender).Text[0] < 'Z') // to handle shift effect
{
m_LastStr = m_LastStr + ((Button)sender).Text.ToLower();
SendKeys.SendWait(m_LastStr);
}
else
{
m_LastStr = m_LastStr + ((Button)sender).Text;
SendKeys.SendWait(m_LastStr);
}
SendKeys.Flush();
|
|
|
|
|
How to generate XML report using SQL Server Reporting Services?
|
|
|
|
|
|
|
I am working with Digital Elevation Models, and some of these are very large and very slow to access.
The files currently are in text format 10,000 rows and 8000 columns , and I was considering that as all items the file contains are positive numbers (ranging from 0 being sealevel to 4000 being highest peak) there must be a much better format to store these for file size and access speed.
What would you suggest as the best file format for this -two bytes for each number, or singles, or doubles or....? The key thing is fast access to the array of data in the file.
Thanks for any suggestions.
|
|
|
|
|
Hi,
a binary file will provide access much much faster than anything text-oriented.
use BinaryWriter/BinaryReader for this.
Warnings with binary files:
- you are responsible for consistent file contents; from the outside, it looks like just a collection of bytes, there is no way to recognize its structure;
- portability is limited to systems that have the exact same data representation; e.g. x86 stores multibyte values in "little-endian" mode (least sighificant byte first), other systems may use
"big-endian" hence not correctly interpret the same file.
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.
modified on Friday, June 10, 2011 12:27 PM
|
|
|
|
|
Binary, as Luc said. And you should probably use short (Int16) values.
Also, can you read and write a group of them at a time?
|
|
|
|