|
It seems that once the databinding is done, and if you change the data you have to rebind to the control. This is what was giving me difficulty before. So what I have to do is run some command like this:
this.mutlicoolgridview.ItemsSource = null;
this.mutlicoolgridview.ItemsSource = SampleData.GetSampleDataNew();
The problem I am having now is this. After running his command about one thousand times, I actually run out of memory. I think that doing this:
this.mutlicoolgridview.ItemsSource = null;
is not such a good idea. Is there a better command to do to free up the memory?
|
|
|
|
|
Xarzu wrote: It seems that once the databinding is done, and if you change the data you have
to rebind to the control.
No you don't. You're doing it wrong. With XAML binding, you bind to a collection that implements ICollectionChanged (such as an ObservableCollection ), then you update the original collection - you don't create a new one, you don't rebind to it.
|
|
|
|
|
Thank you, Pete. I will change and test my code. Is there some way I can force a ICollectionChanged message?
|
|
|
|
|
If you're using an ObservableCollection , you don't have to. It raises the CollectionChanged events for you when you add or remove items.
|
|
|
|
|
Well first Which Datagrid are you referring to?
you can try this in the "Click Event" for your binding.
//Note this Will work if you are using Microsoft Enterprise Library
//else, look at the Code and try to Convert it to one Using ADO
//new DAL
SUNIG dal = new SUNIG();
string msg = "";
//declare a new dataset
DataSet ds = new DataSet();
//pass the data to to the dal, and fetch the data you want to Bind to the Grid.
/*Note: your Stored Procedure Must have to Fetch all the Data from the Table you want to Bind with/without a criteria
eg:
ds = dal.fetchYOURDATA(ref msg);
// do your Validation and Exception CHecking
//eg
if (msg != "")
{
MessageBox.Show("Put your Exception Message Here" + msg);
return
}
//do your databinding here
DataGridView1.Dataset = ds;
DataGridview1.DataBind();
Hope it Helps!!
|
|
|
|
|
It seems that once the databinding is done, and if you change the data you have to rebind to the control. This is what was giving me difficulty before. So what I have to do is run some command like this:
this.mutlicoolgridview.ItemsSource = null;
this.mutlicoolgridview.ItemsSource = SampleData.GetSampleDataNew();
The problem I am having now is this. After running his command about one thousand times, I actually run out of memory. I think that doing this:
this.mutlicoolgridview.ItemsSource = null;
is not such a good idea. Is there a better command to do to free up the memory?
|
|
|
|
|
Roller
I am looking for a good example of a percentage roller in Silverlight. (someone told me that they were called rollers)
The little default BusyIndicator is nice but I have a lot going on in the backgroud for a particular app and because of this, I want one of those rollers that give a percentage of how much time the use can expect to wait. I already have a way of determining what sort of percentage is going on. In other words, I know what sort of data to send the roller. Can anyone help me?
|
|
|
|
|
No idea in Silverlight - but what you're looking for is called a Progress Bar.
|
|
|
|
|
Perhaps you should ask this in the Silverlight forum.
|
|
|
|
|
Please describe what you mean by a 'roller', as it's not a term I'm familiar with, and I guess it isn't just a progress bar since you would already have found that.
|
|
|
|
|
A Roller is what I was told was that little animation that is played when a page loads and it takes a while to complete. Some of the cool flash or silverlight ones have a percentage.
|
|
|
|
|
Okay, that's what I thought you meant, but I wasn't sure.
According to this article[^], you can overwrite the template and put whatever you want in there, including a progress bar with a percentage (and a data binding). If you don't remove the default progress bar (as that article does), you can probably overlay it quite easily.
I haven't actually used this control though.
|
|
|
|
|
I'm making a website on job site.
Whenever I run the login form,I get an error:-
"An attempt to attach an auto-named database for file (C:\Users\ADMIN\Documents\Users.mdf) failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
Now I get an error"Invalid attempt to read when no data is present."
Help me!!!
modified 4-Oct-11 4:51am.
|
|
|
|
|
Are you sure that your mdf file have permissions?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
thnks!
The problem's solved!!!
|
|
|
|
|
Is that the mdf file doesn't have permissions?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
No, there was a small error in the code!
|
|
|
|
|
Ok,that's fine them. In most of the cases that error comes when you don't have permissions on it.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
I'm using BeginReceive to receive data on a Socket.
Sometimes the receive completes synchronously, as indicated by the IAsyncResult.CompletedSynchronously member.
The problem is: I don't know how to retrieve the number of bytes received in this case, because usually it is the EndReceive function that returns this information. But you're not allowed to call EndReceive when it completes synchronously, because it will throw an InvalidOperation exception.
Does anyone know how to retrieve the number of bytes received when the receive completes synchronously?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
While I haven't read it in detail, I think this[^] not so simple thread holds the essentials.
|
|
|
|
|
Thanks, Luc. I read the thread, but there was no answer there.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I have never seen this, and there is nothing in the documentation that suggests it should be possible with an open socket. What exception message do you get? I suspect that the socket is already closed, and BeginReceive detects that and doesn't actually start the receive task. Some forms of socket closure don't get noticed until you try to do an operation on the socket, at which point it throws an exception, though it is usually a SocketException not an InvalidOperationException.
|
|
|
|
|
BobJanova wrote: I have never seen this, and there is nothing in the documentation that suggests it should be possible with an open socket.
Hi Bob,
Please have a look at the Exceptions table at this page: http://msdn.microsoft.com/en-us/library/w7wtt64b.aspx[^]
Look at the entry for EndReceive. It says it will throw InvalidOperation if EndReceive was already called. This is basically what happens when it completes synchronously.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Yes, but BeginReceive doesn't admit to being able to complete synchronously, and my sockets library works even though I wasn't aware it was possible (and therefore didn't code for it). I still think it's something to do with how you're using the socket.
|
|
|
|
|
I agree with the other response.
I have never seen it.
I have certainly seen some unusual errors caused by things like thread aborts and penetration testing though.
As a thought, as noted EndReceive will throw an exception if called twice, thus one reason for the exception is that it is being called twice, by your code.
|
|
|
|