|
Hello,
My aim is to show an animated loading icon beside the dropdownbox. When dropdownbox performs a postback the icon should appear and when it gets loaded completely, the icon should disappear. How can I succeed it in client side instead of in server side.
Would you please let me know how I can accomplish this.
Thanks.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
The easiest would be to display an animated gif[^] and then hid it once the load is completed. That way you will never need to worry about the animation, just that it is visible or not.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
First download animated gif:
- http://www.preloaders.net/[^]
- http://www.ajaxload.info/[^]
html:
<div id="divLoader" style="display:none;"><img alt="loading..." src="/images/loader.gif"/></div>
<asp:DropDownList ID="DropDownList1" runat="server" onclick="ShowHideLoader($('#divLoader'));">
</asp:DropDownList>
javascript/jQuery:
function ShowHideLoader( divLoader )
{
if($( divLoader ).is(':visible'))
$( divLoader ).hide();
else
$( divLoader ).show();
}
Hope that helps,
Morgs
|
|
|
|
|
This seems to be only a partial answer; how do you hide it again when the server acknowledges the postback? I'm not really sure how the ASP.net partial postback actually works, and although it's obviously using AJAX underneath, whether there is somewhere you can hang a JS event handler from that will tell you when the response comes back.
|
|
|
|
|
Hi there,
I made the function clever enough to do one of the possible two things.
I call the function "ShowHide" meaning it can show or hide the animated gif.
The function checks if the gif is visible and hides it otherwise shows it.
So, just call the same function to show or hide it, safe and sound.
Goodluck,
Morgs
|
|
|
|
|
Yes, but you only show how to call it on postback, not on postback response.
|
|
|
|
|
Hi,
I have a treeview with one root node. This node has some children.
The root not is a "TreeViewItemViewModel". This class contains : "ObservableCollection<TreeViewItemViewModel> Items" which are Children nodes.
At beginning, the root node is not expanded and "Children" is empty.
When I expand root node, I load data from DataBase in Children collection :
public override void LoadChildren()
{
this.Items.Clear();
List<Operation> lstOp = DataBAse.GetAllOperations();
foreach (Operation op in lstOp)
{
this.Items.Add(new TreeViewItemViewModel(op));
}
}
If I "unexpand" and expand the root node, I reload children...
public bool IsExpanded
{
get
{
return _isExpanded;
}
set
{
if (value != this._isExpanded)
{
this._isExpanded = value;
RaisePropertyChanged("IsExpanded");
if (this._isExpanded)
{
this.LoadChildren();
}
}
}
}
My issue : when I call "LoadChildren", Items list is cleared but viewmodel are always in memory...
Can someone help me ?
|
|
|
|
|
Of course the VM is in memory. It's the active object - that's what the this. reference indicates - it's the current instance. I'm not sure what you are expecting here.
|
|
|
|
|
My guess is that he refers to the TreeviewItemViewModels he adds to this.Items. That said, I still do not understand what he actually means with they being in memory. They will be garbage collected by the GC when no more references exists and when a the GC is triggered.
|
|
|
|
|
Gotcha. It was the singular of ViewModel that threw me there.
|
|
|
|
|
There are two possible reasons for this:
- They have been dereferenced, but the GC hasn't got around to picking them up yet. If your machine is not running short on memory, the .Net GC is very relaxed about bothering to reclaim unused memory. There's not much you can do about this, but you can put a button on your form that calls GC.Collect for memory checking purposes only and see if the view models get collected (you can give them a destructor that echoes to the console, again for debugging only, to find out).
- You're saving a reference to those view models somewhere. The obvious place is the tree view itself – are you putting a reference to the view model (or to a view class which is tied to the view model) into the Tag property of tree nodes which you never clear? Is the database loading process attaching event handlers which keep references to the view models alive?
|
|
|
|
|
Hi ,
I am good at C# concepts, but i am looking gaining expertise on C# programming
(developing tools e.t.c)
Can any of you please share some links, which contains good basic programs and projects.
Thanks in advance.
Regards,
Anil kumar
|
|
|
|
|
It really depends on what you want to learn in C# or what you master in C#, but as a starting point here are some links, you can explore :
1. C# - By Examples[^]
2. C# - Pizza guys sample project[^]
3. Some more sample projects with source code[^]
This is a very generalised list. If you can come up with some more specific concept viz. Threading in C#, MVC using C#, Design Pattens using C# etc. then, I think, I can provide better links on that.
Hope this helps.
All the best.
I quit being afraid when my first venture failed and the sky didn't fall down.
|
|
|
|
|
|
|
Ask a question once.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Hi ,
I am good at C# concepts, but i am looking gaining expertise on C# programming
(developing tools e.t.c)
Can any of you please share some links, which contains good basic programs and projects.
Thanks in advance.
Regards,
Anil kumar
|
|
|
|
|
Hi,
you can edit a post using the "Edit" widget at its bottom.
you can also delete a message of yours (with the "Delete" widget next to "Edit"), as long as no reply has been posted.
So now is the time to remove the other message, and maybe edit the remaining one ...
|
|
|
|
|
He's also good at ignoring advice!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I've been going around in circles trying to find some reliable (and understandable) information on this task. What I want to do is find a way to put a control inside a PowerPoint presentation.
Some background, a while ago I created a PowerPoint plug-in to allow a user to set some things to happen when a particular slide appears. This works well (after a lot of sweating and banging my head on the wall). I would like to be able to add similar functionality to objects (e.g. pictures or buttons) on a slide. However, Microsoft in their infinite wisdom decided not to expose click events for objects on slides in their API - so case closed, can't be done.
Then I thought, I ought to be able to add an ActiveX control to a PowerPoint presentation, but this is turning out to be more complicated than I hoped. Most ActiveX / C# tutorials I come across are from the perspective of using them in a web page (I've even done it myself in the past, it's easy and it works) but not from the perspective of using them in an Office application.
I tried the CSActiveXCtrl example from the All-In-One code framework and even the Microsoft Interop Forms Toolkit (in VB.NET), but they both act weird in PowerPoint. When they are added to a slide they appear at a default size which clips them. Then when you stretch them it just stretches (zomms) the clipped control. When you start the presentation it displays properly sized and unclipped, but once the presentation is over it disappears from the slide design and running the slide show again doesn't make it come back. Clearly I'm missing some interfaces from the ActiveX control that PowerPoint expects, but don't know what they are or how to implement them.
I saw a potentially related post here[^] which suggested this:
A less labor intensive approach would be to use the C++ MFC control project. This will do much of the heavy lifting for you and will greatly simplify your development effort. Once you have your control created, you could just use TLBIMP.EXE to generate an interop assembly containing the RCW's for you to interop with. I would recommend this approach.
Which sounds promising, but doesn't elaborate on what exactly I need to do to make it work.
I'm pretty much lost here - any pointers or suggestions would be welcomed!
|
|
|
|
|
I have a a multi-purpose application that I am working with. 3 Different forms, one form has log in validation and the another has DateTimePickers. I threw a button on the parent form just to compare saved settings, when I set a Time in DTP say for 11:30 PM and the close that form and go back to the parent form, the DTP Value that I saved doesn't actually get saved till I close my application and re-open it, so I can't compare my alarm times unless I close the application and re-open it. How can I get the form to refresh to the most updated variable that is being stored in my settings?
|
|
|
|
|
Herboren wrote: How can I get the form to refresh to the most updated variable that is being stored in my settings?
Doesn't the settings-class provide a Reload[^]-method? How did you bind to the ApplicationSetting?
Bastard Programmer from Hell
|
|
|
|
|
Could you please clarify:
1. are you working in WinForms, WPF ... or ?
2. what strategy for saving the DateTime(s) you pick are you using now: Serialization ? Application.Settings ? Registry ?
3. you imply you are setting "alarm:" could you say a bit more about the purpose of your application and its 3-form design ?
best, Bill
"Beauty is in the eye of the beholder, and it may be necessary from time to time to give a stupid or misinformed beholder a black eye." Miss Piggy"
modified 22-Sep-11 11:53am.
|
|
|
|
|
Greetings Gurus...
If you could spare a moment..?
The following code is an attempt to retrieve the contents of the Windows Application event log and upload the data to a SQL server.
I am getting 2 errors though and was hoping someone could tell me why the errors are occurring.
Error 1: "A namespace does not directly contain members such as fields or methods" at the line that reads
" SysMonConn.Open();" in bold
Error 2: "Type or namespace definition, or end-of-file expected" at the closing bracket.
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Threading;
using System.Data.SqlClient;
namespace ConsoleApplication3
{
class Program
{
public static void Main();
string logType = "Application";
EventLog ev = new EventLog(logType, System.Environment.MachineName);
EventLogEntry Entry = ev.Entries;
SqlConnection SysMonConn = new SqlConnection(@"Provider = sqloledb.1" +
"Source = 192.168.x.y,1433" +
"Database = EventLogs" +
"Trusted_Connection=yes;" +
"user id=a;" +
"password=b;" +
"connection timeout=30;");
}
SysMonConn.Open();
SqlCommand SMCommand = SysMonConn.CreateCommand();
SMCommand.CommandText = "INSERT INTO dbo.EventTable(Category, ComputerName," +
"Message, SourceName, TimeWritten,Type, UserName)";
SMCommand.Parameters.Add("@Category", System.Data.SqlDbType.NVarChar, 50) = Entry.Category;
SMCommand.Parameters.Add("@ComputerName", System.Data.SqlDbType.NVarChar, 50) = Entry.MachineName;
SMCommand.Parameters.Add("@Message", System.Data.SqlDbType.NVarChar, 250) = Entry.Message;
SMCommand.Parameters.Add("@SourceName", System.Data.SqlDbType.NVarChar, 50) = Entry.Source;
SMCommand.Parameters.Add("@TimeWritten", System.Data.SqlDbType.NVarChar, 50) = Entry.TimeWritten;
SMCommand.Parameters.Add("@Type", System.Data.SqlDbType.NVarChar, 50) = Entry.EntryType;
SMCommand.Parameters.Add("@UserName", System.Data.SqlDbType.NVarChar, 50) = Entry.UserName;
ev.Close();
}
}
Any assistance greatly appreciated
|
|
|
|
|
your curly brackets are all wrong, you need one when opening Main (rather than a semi-colon), and the matching one is below ev.Close(); , so the one in front of SysMonConn.Open() should be removed.
If you put the curlies right, the right indentation of your code would ensue automatically (at least in real IDE's such as Visual Studio); if it looks almost right at the moment, it tells me you have been adding/removing tabs yourself.
|
|
|
|