|
I am using C# and have a DataGrid. Within the grid there is a template column with a DropDownList in the footer template. I populate this list with a list of valid users. I would like the persons name who logged on to be the entry that is selected by default. How can I access this DropDownList in order to set the field to the default user name in the list? Here is the code that I use to access the field during an add.
DropDownList analyst;
analyst = (DropDownList)(e.Item.Cells[3].FindControl("cboAnalystFooter"));
This code is in the DataGrid_Command() function that is triggered by an Insert event. How do I access this field outside of this function, such as in the Page_Load() function?
Thanks for the help!
Scott
Scott
|
|
|
|
|
hi,
I have a Web-Service which runs on a Desktop and a Mobile Web Client which consumes this Web-Service from a PDA. Now I want to log the method-call and the time when a user executes an action with the PDA on the Desktop by WLAN in a database or in a file. Important is that it should be a generic solution, so not only the tasks from a Windows Mobile Client which consumes a Web-Service should be logged but for any other Microsoft specific Web Application which consumes some application on a desktop should be a possibility available to log the events.
An important aspect i have to consider is the performance. – This solution should not have such a negative impact on the performance.
Hopefully someone could give me tipps or hints how i can solve this problem.
regards,
mathon
|
|
|
|
|
Each of your methods in your WebService would have to log this information. You can't get the information about the appliocation that called your WebService though, but you can log all the parameters that were passed. But, like I said, you have to include this code in each of your WebService's public methods.
Any logging you do will degrade performance to some extent. It's dependent on how much information you log and where the log is written to...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
There is no possibility to log the information (the method-call->the name of the method and the time) of a WebService which is called by a client without changing the origin code?? I thought there are solutions...
mathon
|
|
|
|
|
Two ways to do it, neither of them good or easy...
- A packet sniffer running between the WebService and the Client. Not a good idea and not easy to pull out and log the information you want.
- Write a shim WebService that exposes all the same methods and parameters that forwards requests back and forth to the real WebService, while logging what's called and with what parameters. Also, not good, not easy, and is a duplication of effort because you have to duplicate the original WebService interface exactly.
The best method is to write the logging code into the original interface as you write it. Then you could at least configure it to look at it's configuration file and wee if it needs to log information or not.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have seen various framework functions that take piped enumerated properties, by this I mean :
object o = FunctionName(Property.Value1|Property.Value2|Property.Value3)
I would also like to be able to do this through property accessors aswell as functions, a framework example of this is the System.Windows.Forms.Anchor property :
label1.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
How can I implement this type of functionality into my own code?
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Those values are not "piped" as you call it, it's the C# OR operator. They're just bit flag values OR'd together to come up with a composite value. All the constants are usually defined in an enum or are public constants in your class. For instance if the values of the constants your provided in your example were:
public class AnchorTest
{
enum AnchorStyles
{
Bottom = 0x0001;
Right = 0x0002;
Left = 0x0004;
Top = 0x0008;
}
}
Your property would then take a parameter and/or return a parameter of type AnchorStyles:
public class AnchorTest
{
private AnchorStyles m_AnchorStyle;
enum AnchorStyles
{
Bottom = 1,
Right = 2,
Left = 4,
Top = 8
}
public AnchorStyles AnchorStyle
{
get { return m_AnchorStyle; }
set { m_AnchorStyle = AnchorStyle; }
}
}
Now, when you OR, or '|' your values together, you'll get the values added together. 1 OR 2 will equal 3, 1 OR 4 will equal 5, 1 OR 2 OR 4 OR 8 will equal 15.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi everyone,
I have a AxSHDocVw.AxWebBrowser on a Form in my Windows Forms application. Now, is it possible somehow to create an HTML document on the fly (programmatically from my Windows Forms application) that will be displayed instead of navigating to an existing document using AxWebBrowser.Navigate(...) ?
Thanks for any clues in advance!
Rado
|
|
|
|
|
Funnily enough I was doing this very same thing today.
I couldnt find a way to, for example, pass in a HTML string and get the browser to render it.
So, using the data from the form components I created a HTML string and used a FileStream to write the this to a temporary file, I then used :
object obj = null;
myBrowser.Naviagate(pathToFile, ref obj, ref obj ref ob ref obj, ref obj)
Note : I may have not typed in the right amount of "ref obj" as I am doing this from memory.
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
What you're both going to need to learn to use is MSHTML. Which is basically DHTML. So if you already know DHTML it makes it really easy. If you don't know DHTML but you understand XML, then you shouldn't have too many problems. So what you're going to need to do is get ahold of the Body element of the Document page and insert the HTML that you need by either creating the elements on the fly which is the most correct way, or by doing something like body.InnerHTML = "my html stuff". If this doesn't make any sense I'll try to find you some links that I used to learn it.
|
|
|
|
|
Navigating to a local file is fine, in fact, Reflector used to do this in a version a while ago (I haven't checked to see how Lutz is doing it now).
- Nick Parker My Blog | My Articles
|
|
|
|
|
That's the way I went in the end, because I didn't want to write to a temporary file each time. I have created an HTML template document with a few elements, like a header and text field, and then used MSHTML to locate these elements and set their innerHTML attributes.
Looked like a more elegant way for my purpose.
If anyone needs the code, I can post it here, it was just a few lines.
Rado
|
|
|
|
|
And of course you can just navigate to "about:blank" and it will load an empty document immediately.
Judah Himango
|
|
|
|
|
I am trying to read the memory being used by a process but I can't quite figure out how to do it (or if it's even possible). I can get a reference to the process using Process.GetProcessesByName and I can get the base address using Process.MainModule.BaseAddress (which returns a IntPtr). I thought that by using IntPtr.ToPointer() and casting to a char* I would be able to read the memory as a stream of chars but it doesn't work because it always throws a NullReferenceException when I try and dereference the pointer.
Can anybody help me out here?
Thanks
class Class1
{
[STAThread]
static unsafe void Main(string[] args)
{
Process[] p = Process.GetProcessesByName("notepad");
ProcessModule pm = p[0].MainModule;
Console.WriteLine(pm.BaseAddress);
char* ptr = (char*) pm.BaseAddress.ToPointer();
char c = *ptr;
Console.WriteLine(c);
Console.ReadLine();
}
}
"Where do we go to get our good name back?...we go where we always go when a dramatic change is needed. We go to the ballot box" - Al Gore 5/26/04
|
|
|
|
|
|
Writing a trainer
"Where do we go to get our good name back?...we go where we always go when a dramatic change is needed. We go to the ballot box" - Al Gore 5/26/04
|
|
|
|
|
That still doesn't explain what you are trying to do with your example above.
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
Yes, thank you, that is what I meant. Sorry I should have been clearer.
"Where do we go to get our good name back?...we go where we always go when a dramatic change is needed. We go to the ballot box" - Al Gore 5/26/04
|
|
|
|
|
|
Thanks, that's a great article. I have got as far as using PInvoke with the OpenProcess and ReadProcessMemory functions, but the article doesn't use the WriteProcessMemory which I'm having trouble with. I got it working and got it to change the area of memory which I am sure is the right place, but it hung the game I'm not sure if I'm just messing with the wrong place or if I'm doing something wrong. Oh well. I was only doing it for a bit of fun.
"Where do we go to get our good name back?...we go where we always go when a dramatic change is needed. We go to the ballot box" - Al Gore 5/26/04
|
|
|
|
|
I work for a printing company and am writing a program (in C#) which displays an image of what is to be printed on our press. However i need the program to also print the image on a normal inkjet printer as well. This image needs to be printed at a resolution of 240 dpi.
Does anyone know if it is possible to set the printers resolution at design time?
|
|
|
|
|
I have a class library for which I am trying to discover it's methods.
The first class works fine since it has all methods marked public. The second method does not because it has all of its methods marked protected.
Here are the two BindingFlags attempts I've tried:
MethodInfo[] items = assembly.GetMethods
(BindingFlags.Public|BindingFlags.Instance|BindingFlags.NonPublic|BindingFlags.Static);
Is there a BindingFlags enum I can use to expose those protected methods or do I have to do something a bit more complex?
Thanks
Michael
This signature left intentionally blank
|
|
|
|
|
Try the following, it works for me:
BindingFlags bf = BindingFlags.Instance | BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
- Nick Parker My Blog | My Articles
|
|
|
|
|
Well, I tried this and it did not work either.
I ran reflector, and it is able to expand the protected methods. So I know there has got to be a way. But flattening the heirarchy did not do it.
I have determined that ReflectionPermissions must be used. Now all I have to do is figure out WHERE!
This signature left intentionally blank
|
|
|
|