|
This is C# Forum. Your question is related to ASP.NET. So please Post it to ASP.NET Forum.
Thanks
|
|
|
|
|
You can access the method this way:
((ClassNameOfASPXPage)(this.Page)).MethodName();
Make sure the method is internal/public .
It's not necessary to be so stupid, either, but people manage it. - Christian Graus
|
|
|
|
|
Hi,
Thats what ive been trying - but 'ClassNameOfASPXPage' just isnt available in the control.
- Ive put them in the same namespace, no luck - ive put them in different namespaces and added a reference in the control to the parent namespace - but the parent namespace is not available...
The funny thing is - if i create 2 aspx pages lets say 1 is public testclass1 and the other is public testclass2 - I cant reference testclass1 from testclass2 - even if they are in the same namespace. surely something is wrong here but i cant figure out what...
Thanks,
Chas
|
|
|
|
|
OK,
adding a directive like <%@ Reference Page= "~/TestPage1.aspx" %> to the control
will make the parent class available...
but a better way of doing this was to use events...
in the control:
public delegate void GridEventHandler(CategoryType categoryType);
public event GridEventHandler GridItemSelected;
private void OnGridItemSelected(CategoryType categoryType)
{
if (GridItemSelected != null)
{
GridItemSelected(categoryType);
}
}
called using:
OnGridItemSelected(selectedCT);
and in the parent page:
categoryTypeGrid.GridItemSelected += new Controls_CategoryTypeGrid.GridEventHandler(categoryTypeGrid_GridItemSelected);
modified on Sunday, August 2, 2009 9:17 AM
|
|
|
|
|
I need to check whether a username and password are valid, and if so, if that user is in a special group on Active Directory.
I'm developing an intranet only system that (hopefully) will allow a user to login at program startup using their Active Directory credentials.
If anyone knows any C# code that does this it would be greatly appreciated. I've done a thorough Google search, but haven't found anything that returns a helpful response.
Thanks
|
|
|
|
|
|
I've already tried the options on that site, one enabled me to check whether a user was able to logon to the active directory, but not what groups it is in, and I've been unable to get Get "Get User Group Memberships" working; it gives an unspecified error on:
public ArrayList AttributeValuesMultiString(string attributeName,
string objectDn, ArrayList valuesCollection, bool recursive)
{
DirectoryEntry ent = new DirectoryEntry(objectDn);
PropertyValueCollection ValueCollection = ent.Properties[attributeName];
System.Collections.IEnumerator en = ValueCollection.GetEnumerator();
while (en.MoveNext())
{
if (en.Current != null)
{
if (!valuesCollection.Contains(en.Current.ToString()))
{
valuesCollection.Add(en.Current.ToString());
if (recursive)
{
AttributeValuesMultiString(attributeName, "LDAP://" +
en.Current.ToString(), valuesCollection, true);
}
}
}
}
ent.Close();
ent.Dispose();
return valuesCollection;
}
|
|
|
|
|
Hey peoples ............ if I am not late i was just to tell you that there is a nice iGrid.Net dll which is used as listViewItem ................. I got it yesterday from this site .................... on latest news on C# ................... have a look @ it and give your suggestions
Thanks a lot
|
|
|
|
|
Dear all
am new to c#(2008).
i created a stored procedure in sql server 2000.
"select * from employee where joindate between @d1 and @d1"
I was using Table Adapter fill,get methods.
when i tried to pass the date value which in "MM/dd/yyyy"
it raises error message invalid datetime,then
i declared DateTime variable and use Datetime.Parse(date in "MM/dd/yyyy"),
DateTime.Parseexact,error not a valid datetime. i use Culture info ("en-US"),but no luck.
|
|
|
|
|
|
I hope you are NOT storing your date values as varchar in the database, you would be committing a major offence doing that.
I use paramerterised queries and pass a date type into the sp. If I have to pass a string of a date to a proc I use 106 = "dd MMM yyyy" there is NO ambiguity in that format.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hello
Skater.NET offers software licensing/lock - http://rustemsoft.com/SkaterDoc/index.html?order.htm[^]
Price quite reasonable too - but:
(a) Licenser not free so I'm lasing with Skater to see if I can download an "Evaluation Copy"
(b) We do 64 bit, apparent Skater only support 32 bit version!?
(c) Any other suggestion?
Thanks
dev
|
|
|
|
|
I don't have a specific third party licensing solution to recommend, but see my answer to your post in the thread about obfuscation: I hope it can give you some ideas.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
What I need to do is something like this.
DataCruncher.exe < input.bin > output.bin
It is an application that is called in the command prompt.
The input.bin file is piped in, and the result is outputed to output.bin. Works great.
Now instead of starting the app from a command prompt, I need to call it from a C# app.
ProcessStartInfo info = new ProcessStartInfo(location);
info.Arguments = BuildArgs();
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
info.UseShellExecute = false;
_process = Process.Start(info);
_toApp = _process.StandardInput.BaseStream;
_fromApp = _process.StandardOutput.BaseStream;
The input is in binary format, and so is the output, so I used the basestream instead of the StreamReader.
My problem is that it is blocking when im reading from the standard output.
while (true)
{
int read = _fromApp.Read(readbuffer, 0, readbuffer.Length);
if (read == 0)
break;
}
It looks like it is blocking the stream until it has all the bytes to fill the readbuffer array.
Is there something I should be aware of when read/writting to a process?
|
|
|
|
|
Hi,
the way I understand it, but this could be wrong, I don't have a reference to this, is this:
- the process input and output are designed to be used for text;
- the data is transferred from one process to the other on a line by line basis, and each full line is somehow guaranteed to become available in one go.
So it's my guess you aren't getting any data because there aren't any newline characters in your binary data.
You could experiment with binary data that happens to contain some \r or \n or \r\n sequences, to see whether that splits it in smaller parts.
If so, seems like you should either abandon binary data, or choose another way of communicating (actual files, memory mapped files, ...)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi
Thank you for your quick response.
I did some more work on it, and it looks like it was a threading issue.
If I read the out stream in a diferent thread, it does not block. Im not sure why, but it works.
|
|
|
|
|
Yeah, I couldn't tell the threading situation from the code you have shown; if you were performing the reads from the GUI thread (say in a button click handler), then all the GUI changes you ordered in there would not become effective until that handler (i.e. all reads) have finished (unless you added some extra calls such as Invalidate or Refresh).
If you do use a separate thread, that one can't touch any Controls; you would need Control.Invoke for that. This[^] explains it.
And finally, if your data were text, not binary, you could have used the OutputDataReceived event instead of a separate thread...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Yeah, I look at the OutputDataReceived event, and for a moment considered doing reverse text encoding on the string - but that was an absolute last resort
The threading is handled internally, and has no contact to the GUI.
You can se a sample of it at:
http://bendtsen.net/sample.txt[^]
|
|
|
|
|
Regards, I am trying to run cmd.exe from a button click event.
this is where I am starting off.
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@"CMD.exe","attrib C:\\save.txt +s +h");
}
when I click on button1 another instance of the program starts.
also the command window never opens.
am I lame?
|
|
|
|
|
rick0557 wrote: private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@"CMD.exe","attrib C:\\save.txt +s +h");
}
Try This,
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@"CMD.exe","/C attrib C:\\save.txt +s +h");
}
The only change I have made, is I have added "/C" with the Second Parameter.
|
|
|
|
|
How about System.IO.File.SetAttributes instead?
|
|
|
|
|
nope...its for file attributes like, readonly, hidden...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Basicly what I am tring to do is change a files properties to super hidden.
(or system hidden) like the protected operating files. read about a way to do this manually
with the cmd.exe(comand line). one could probably build a batch file to do this. But the clean
way would be to do it with in the C# application that creates the file in the first place.
But Im not sure how to go about doing it. the "File.Atributes" only has the general type properties
.It has "hidden" and also "System". But what I need to do is tuck away a file that my program can access And be sure that it wont get deleted or changed.
Any Help would be greatly Appriceated.
Regards;
Rick
|
|
|
|
|
I have a Program that displays a List in a textBox such as
Items
Items
Items
is there way that I can make the list in the textBox Click able so that it leads you to a Page depending on which item you click with out showing such as.
http://Site/items
http://Site/items
^_^ thanks for any help.
|
|
|
|
|
Does it have to be a TextBox?
This would be fairly trivial if you were using a listbox.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|