|
Hi i have cascading dropdown,
In that i have bind some datas from my database,
Now based on the selection my grid want to bind with out postback event,
Anypossiblity is there to do?,
Plz hlp me,
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
New one wrote: Anypossiblity is there to do?,
Yes, in the ASP.NET forum.
|
|
|
|
|
use ajax
wasim khan
|
|
|
|
|
Hello everyone,
From MSDN about Type.GetFields Method (BindingFlags),
http://msdn.microsoft.com/en-us/library/6ztex2dc(VS.80).aspx
What means "When overridden in a derived class, searches for the fields defined for the current Type"? I can not find related description for this point in the MSDN related sample. Especially "overridden in a derived class" and "defined for the current Type"?
thanks in advance,
George
|
|
|
|
|
George_George wrote: What means "When overridden in a derived class, searches for the fields defined for the current Type"?
System.Type is an abstract class, and GetFields is an abstract method. There are several classes that derived from Type , and MSDN says that when it is overridden in a derived class, it must return the fields associated with the "underlying" type that the Type object represents.
|
|
|
|
|
Thanks Senthil,
I have written a test case, I am using a base class type variable to point to a derived type and in the derived type, I override a method of base class.
But it seems I can get nothing in variable fields. Any ideas?
class Program
{
class Foo
{
public static int abc;
virtual public void bcd()
{
}
}
class Goo : Foo
{
override public void bcd()
{
}
}
static void Main(string[] args)
{
Foo f = new Goo();
FieldInfo[] fields = f.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public);
return;
}
}
regards,
George
|
|
|
|
|
George_George wrote: But it seems I can get nothing in variable fields. Any ideas?
The text in the MSDN page is for people deriving from System.Type , for whatever reason. From a user's perspective, it returns the list of fields in the class represented by the Type.
|
|
|
|
|
Thanks Senthil,
The fields only for member variables, not for functions?
regards,
George
|
|
|
|
|
GetFields returns only fields (member variables) in that type. Type.GetMethods[^] returns functions defined in that Type.
|
|
|
|
|
Thanks Senthil,
Looks like GetMembers return both methods and fields, and GetMethods/GetFields returns just method/field? So, GetMembers is more powerful.
regards,
George
|
|
|
|
|
|
I have tested it, leppie!
Looks like GetMembers is more powerful than GetFields.
regards,
George
|
|
|
|
|
S. Senthil Kumar wrote: for whatever reason.
Every single type defined derives from Type as a RuntimeType.
|
|
|
|
|
For any user defined class, does the class implicitly derives from Type?
regards,
George
|
|
|
|
|
The field abc is defined as static, but in your GetFields() call you ask it to return only instance fields.
|
|
|
|
|
Thanks Vega02,
I think the root cause is, I do not know GetFields will not return methods before.
regards,
George
|
|
|
|
|
Can any body tell me how to add new windows service
wasim khan
|
|
|
|
|
You mean to say, how to install a window service or you want to create a service?
Parwej Ahamad
R & D with IIS 5.0/6.0
|
|
|
|
|
hi i have a service that is created by my friend in VB and now i want to add it my Computer Services by C# code how will i do this
wasim khan
|
|
|
|
|
You can use the ServiceInstaller class. It's part of the BCL.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Well there are certain ways to add a service to your windows registered services.
1) You can use the InstallUtil tool that comes with the .Net Framework;Go to the Visual Studio Command prompt and there type InstallUtil Path-to-Assembly-to-be-installed-as-service
This is a manual procedure.
2) Create a new setup project using the Visual Studio Setup Wizard and then under the "File System Editor" add the output (the assembly that you want to install as service", after this go to "Custom Actions Editor", you will see four folders there, 1- Install, 2- Commit, 3- Rollback and 4- Uninstall, right click on Install and click on "Add Custom Action" from the resulting menu, under the result dialog, locate the application folder and locate the assembly of the service that you just added in Application Folder, double click on this assembly.
Now when you run the setup project, the service will be added to your windows services if everything goes well.
For both the procedures, you would need to go to windows services console and start the service manually.
Muhammad Talha
|
|
|
|
|
thanx for ur breif Answere i think that will help me
wasim khan
|
|
|
|
|
Talha can u tell me about how can i add service using C# code
and thnax for ur first replay it really work
wasim khan
|
|
|
|
|
Well I also looked a sample on Code Project for this which calls the InstallUtil utility through code, I guess if you search this site for Dynamic Windows Service Installer, you will come across that....
anyway the code is as:
<br />
using System;<br />
using System.Diagnostics;<br />
using System.Net;<br />
using System.IO;<br />
<br />
namespace ServiceInstaller<br />
{<br />
public enum WindowsServiceAccountType<br />
{<br />
LocalService,<br />
NetworkService,<br />
LocalSystem,<br />
User<br />
}<br />
public class WindowsServiceInstallInfo<br />
{<br />
#region "FIELDS"<br />
<br />
private System.String _windowsServiceName;<br />
private System.String _wsDescription;<br />
private readonly string _windowsServicePath;<br />
private readonly string _windowsServiceAssemblyName;<br />
private WindowsServiceAccountType _wsAccountType;<br />
private readonly string _wsAccountUserName;<br />
private readonly string _wsAccountPassword;<br />
<br />
#endregion<br />
<br />
#region "CONSTRUCTOR"<br />
public WindowsServiceInstallInfo(string windowsServicePath, string windowsServiceAssemblyName, WindowsServiceAccountType wsAccountType)<br />
: this("", windowsServicePath, windowsServiceAssemblyName, wsAccountType) { }<br />
<br />
public WindowsServiceInstallInfo(string windowsServiceName, string windowsServicePath, string windowsServiceAssemblyName, WindowsServiceAccountType wsAccountType)<br />
: this(windowsServiceName, "", windowsServicePath, windowsServiceAssemblyName, wsAccountType) { }<br />
<br />
public WindowsServiceInstallInfo(string windowsServiceName, string description, string windowsServicePath, string windowsServiceAssemblyName, WindowsServiceAccountType wsAccountType)<br />
: this(windowsServiceName, description, windowsServicePath, windowsServiceAssemblyName, wsAccountType, "", "") { }<br />
<br />
public WindowsServiceInstallInfo(string windowsServicePath, string windowsServiceAssemblyName, string wsAccountUserName, string wsAccountPassword)<br />
: this("", windowsServicePath, windowsServiceAssemblyName, wsAccountUserName, wsAccountPassword) { }<br />
<br />
public WindowsServiceInstallInfo(string windowsServiceName, string windowsServicePath, string windowsServiceAssemblyName, string wsAccountUserName, string wsAccountPassword)<br />
: this(windowsServiceName, "", windowsServicePath, windowsServiceAssemblyName, wsAccountUserName, wsAccountPassword) { }<br />
public WindowsServiceInstallInfo(string windowsServiceName, string description, string windowsServicePath, string windowsServiceAssemblyName, string wsAccountUserName, string wsAccountPassword)<br />
: this(windowsServiceName, description, windowsServicePath, windowsServiceAssemblyName, WindowsServiceAccountType.User, wsAccountUserName, wsAccountPassword) { }<br />
<br />
private WindowsServiceInstallInfo(string windowsServiceName, string description, string windowsServicePath, string windowsServiceAssemblyName, WindowsServiceAccountType wsAccountType, string wsAccountUserName, string wsAccountPassword)<br />
{<br />
_windowsServiceName = windowsServiceName;<br />
_wsDescription = description;<br />
_windowsServicePath = windowsServicePath;<br />
_windowsServiceAssemblyName = windowsServiceAssemblyName;<br />
_wsAccountType = wsAccountType;<br />
_wsAccountUserName = wsAccountUserName;<br />
_wsAccountPassword = wsAccountPassword;<br />
<br />
if (_wsAccountType == WindowsServiceAccountType.User && _wsAccountUserName == "")<br />
{<br />
throw new Exception("Username must be provided if AccountType to start the Windows Service is USER");<br />
}<br />
}<br />
#endregion<br />
<br />
#region "PROPERTIES"<br />
public System.String WindowsServiceName<br />
{<br />
get<br />
{<br />
return _windowsServiceName;<br />
}<br />
set<br />
{<br />
_windowsServiceName = value;<br />
}<br />
}<br />
public string WindowsServiceDescription<br />
{<br />
get<br />
{<br />
return _wsDescription;<br />
}<br />
set<br />
{<br />
_wsDescription = value;<br />
}<br />
}<br />
public string WindowsServicePath<br />
{<br />
get<br />
{<br />
return _windowsServicePath;<br />
}<br />
}<br />
public string WindowsServiceAssemblyName<br />
{<br />
get<br />
{<br />
return _windowsServiceAssemblyName;<br />
}<br />
}<br />
public WindowsServiceAccountType wsAccountType<br />
{<br />
get<br />
{<br />
return _wsAccountType;<br />
}<br />
}<br />
public string wsAccountUserName<br />
{<br />
get<br />
{<br />
return _wsAccountUserName;<br />
}<br />
}<br />
public string wsAccountPassword<br />
{<br />
get<br />
{<br />
return _wsAccountPassword;<br />
}<br />
}<br />
#endregion<br />
}<br />
<br />
public class WindowsServiceInstallUtil<br />
{<br />
public static string InstallUtilPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();<br />
<br />
protected WindowsServiceInstallInfo _wsInstallInfo;<br />
<br />
public WindowsServiceInstallUtil(WindowsServiceInstallInfo wsInstallInfo)<br />
{<br />
_wsInstallInfo = wsInstallInfo;<br />
}<br />
private static bool CallInstallUtil(string installUtilArguments)<br />
{<br />
Process proc = new Process();<br />
proc.StartInfo.FileName = Path.Combine(InstallUtilPath, "installutil.exe");<br />
proc.StartInfo.Arguments = installUtilArguments;<br />
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;<br />
proc.StartInfo.RedirectStandardOutput = true;<br />
proc.StartInfo.UseShellExecute = false;<br />
<br />
proc.Start();<br />
<br />
string outputResult = proc.StandardOutput.ReadToEnd();<br />
proc.WaitForExit();<br />
if (proc.ExitCode != 0)<br />
{<br />
return false;<br />
}<br />
return true;<br />
}<br />
public bool Install()<br />
{<br />
return Install("");<br />
}<br />
public virtual bool Install(string logFilePath)<br />
{<br />
string installUtilArguments = GenerateInstallUtilInstallArgs(logFilePath);<br />
return CallInstallUtil(installUtilArguments);<br />
}<br />
<br />
protected string GenerateInstallUtilInstallArgs(string logFilePath)<br />
{<br />
string installUtilArguments = " /account=\"" + _wsInstallInfo.wsAccountType + "\"";<br />
if (_wsInstallInfo.WindowsServiceName != "")<br />
{<br />
installUtilArguments += " /name=\"" + _wsInstallInfo.WindowsServiceName + "\"";<br />
}<br />
if (_wsInstallInfo.WindowsServiceDescription != "")<br />
{<br />
installUtilArguments += " /desc=\"" + _wsInstallInfo.WindowsServiceDescription + "\"";<br />
}<br />
if (_wsInstallInfo.wsAccountType == WindowsServiceAccountType.User)<br />
{<br />
installUtilArguments += " /user=\"" + _wsInstallInfo.wsAccountUserName + "\" /password=\"" + _wsInstallInfo.wsAccountPassword + "\"";<br />
}<br />
<br />
installUtilArguments += " \"" + Path.Combine(_wsInstallInfo.WindowsServicePath, _wsInstallInfo.WindowsServiceAssemblyName) + "\"";<br />
<br />
if (logFilePath.Trim() != "")<br />
{<br />
installUtilArguments += " /LogFile=\"" + logFilePath + "\"";<br />
}<br />
<br />
return installUtilArguments;<br />
}<br />
<br />
public bool UnInstall()<br />
{<br />
return UnInstall("");<br />
}<br />
<br />
public virtual bool UnInstall(string logFilePath)<br />
{<br />
string installUtilArguments = GenerateIntallUtilUnInstallArgs(logFilePath);<br />
return CallInstallUtil(installUtilArguments);<br />
}<br />
<br />
protected string GenerateIntallUtilUnInstallArgs(string logFilePath)<br />
{<br />
string installUtilArgs = " /u ";<br />
if (_wsInstallInfo.WindowsServiceName != "")<br />
{<br />
installUtilArgs += " /name=\"" + _wsInstallInfo.WindowsServiceName + "\"";<br />
}<br />
installUtilArgs += " \"" + Path.Combine(_wsInstallInfo.WindowsServicePath, _wsInstallInfo.WindowsServiceAssemblyName)+"\"";<br />
if (logFilePath.Trim() != "")<br />
{<br />
installUtilArgs += " /LogFile=\"" + logFilePath + "\"";<br />
}<br />
return installUtilArgs;<br />
}<br />
}<br />
}<br />
let me know if you need further assisstance.
Muhammad Talha
|
|
|
|
|
thnax Talha i think that is enough for me
wasim khan
|
|
|
|
|