|
John Simmons / outlaw programmer wrote: I am not trying to access the client machine
Actually you are. You are trying to get the client machine to give up some information, the IP address.
|
|
|
|
|
It's not "giving up" anything. The originating IP address is part of every TCP/IP communication. If it wasn't, there would be no way to issue a response to a request.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
|
Hello,
Is it possible to add click event to image (server control) in ASP.net 2005?
Shay Noy
|
|
|
|
|
You can use Image Button Control insted of Image Control
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
OK, but is it possible to draw line on imagebutton? I need to draw lines and on click to change the line color?
Thank you
Shay Noy
|
|
|
|
|
shaynoy wrote: OK, but is it possible to draw line on imagebutton? I need to draw lines and on click to change the line color?
Where do you want to draw a line ? Can you please explain your exact requirment ?
Thank you !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I need to create chart that contains lines according to y=ax+b. After that the user will be able to click on those lines and get some info.
The problem is that I don't know on which container to draw those lines. This container must include click event otherwise how can I click on line if the container do not have click event?
Shay Noy
|
|
|
|
|
For this kind of features why you are not looking at any ASP.NET Chart Control ? That can easily resolve your issue and even you can extend them as you want. If you are using .NET 3.5 SP1 Framework, Microsoft having their own chart control inbuild with it.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I have already checked for a chart control and found for ASP.net 2, but all those charts do not support click event on the drawn line.
Shay Noy
|
|
|
|
|
u need to create a custome control for it...
|
|
|
|
|
Can you please, be more specific
Thank you
Shay Noy
|
|
|
|
|
I am relatively new to ASP.NET Web Parts and would like to implement a solution using ASP.NET rather than a workaround like I have in the past. Having extensive experience with Apache servers I can, and have, code a workaround using DHTML and JavaScript, but would like to learn the ASP.NET way to accomplish this common and seemingly simple task.
I am developing a SharePoint Web Part and for discussion lets say it has a drop down list and a button. The scenario is pretty simple the user selects an item from the drop down list and clicks on the button to process the entry.
The button fires off an AutoPostBack and when the button onClick event fires after return from the AutoPostBack the selected index of the drop down box is -1. How do I capture the the selected index of the drop down box after clicking the button but before the round trip to the server or an alternative solution?
|
|
|
|
|
You just need to handle the OnSelectedIndexChanged event of the dropdownlist.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: You just need to handle the OnSelectedIndexChanged event of the dropdownlist.
I would need to set the AutoPostBack on the drop down list to true in order to fire that event and it would cause a round trip to the server each time the index was changed.
Aside from causing the screen to blink and the time needed for a round trip before the interface is responsive again I believe it would fire after the round trip to the server and more precisely after the Page CreateChildControls, RenderControls and OnLoad events making the SelectedIndex value -1, just like when I try to retrieve it in the button onClick event.
|
|
|
|
|
You don't need to set Autopostback on the dropdownlist. The OnSelectedIndexChanged event will be triggered during a postback, any postback, including one caused by the button.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: You don't need to set Autopostback on the dropdownlist. The OnSelectedIndexChanged event will be triggered during a postback, any postback, including one caused by the button.
Even so it is triggered after the Page CreateClildControls, RenderControls and OnLoad events so the drop down box SelectedIndex is reset to -1 before it is triggered.
|
|
|
|
|
Have you tried it or are you just theorizing?
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: Have you tried it or are you just theorizing?
I have tried. The order of events for page rendering are the Page events CreateChildControls, RenderControls, OnLoad, (in that order) and then the control events take place.
Override these page events, add control events and write out a message to a log when each fires and you will see them firing in that order.
When I say I am a newcomer to ASP.NET I mean I have been writing Web Part code for the past 2 years as opposed to 10 years coding for Apache servers.
I still consider myself an intermediate when it comes to Web Parts and am just learning about things like Shared Zone, Display Zone, Edit Zone and Connection Zones, and their capabilities, but am gaining the knowledge to consider myself an expert over the next year or two. I don't consider myself expert until I know every aspect of a technology.
Having said that I don't speculate about a technology, but say things only after I perform due diligence in learning the technology.
I must ask you the question now, have you tried what you are saying or are you just theorizing?
For example, it is my understanding that unless you set the AutoPostBack to true the control events will not fire on controls that are set to false by default, such as a drop down box. This is consistent with my testing. If you know it to be wrong from experience please let me know how I can verify that.
|
|
|
|
|
JimmyRopes wrote: I have over 36 years professional experience in developing solutions
JimmyRopes wrote: I must ask you the question now, have you tried what you are saying or are you just theorizing?
Don't be an ass (that's my job) and take a deep breath before responding. Without sitting there implementing paired programming, I have no way knowing what you have tried or not. You are not the ony one around here with experience, most just don't push it everyone's face like this.
Yes, I have constructed webparts that repond to postback events.
One way to handle this is to package your webpart as a user control. Some like this approach when the control has more interactive elements such as this. You may also want to read up on IPostBackDataHandler[^] and IPostBackEventHandler[^] if you haven't already
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: Don't be an ass (that's my job)
That is what I was thinking when you said that the drop down box SelectedIndexChanged event will fire when the AutoPostBack is set to false.
It is my experience that in order to get a drop down box to fire an event you must set the AutoPostBack event to true. Do you have evidence that it will fire without the AutoPostBack being set to true? I think not, but I was willing to overlook that because I wanted to see if you had any other suggestions.
Instead you responded "Have you tried it or are you just theorizing?". Who is being the ass there?
I know you don't know what my experience level is so I told you. That way you wouldn't assume I am a new comer to the field or do not know how to test implementations before asking for help when I run out of options at the time. Your response asking me "Have you tried it or are you just theorizing?" smacked of arrogance.
A look at your profile reveals that you are undoubtedly good at taking tests but that just means that you are good at taking tests, nothing more.
I gain my knowledge the old fashioned way, through empirical (unit) testing. I know it has fallen out of favor these days, probably because it takes a lot of work.
Mark Nischalke wrote: One way to handle this is to package your webpart as a user control. Some like this approach when the control has more interactive elements such as this.
In my original post I mentioned that it was a SharePoint Web Part. This code is published as a user control that is included on the page in an edit zone.
I override the CreatChildControls, RenderControls and OnLoad Page events, as well as setting some control events. I have logged essential information from each of these events so I will know know what is going on at each stage of rendering.
If you have any examples of capturing the state of the drop down control prior to post back please paste a code snippet in a reply and where in the code (which event) to use it.
Thank you for your assistance. I am not interested in speculating about how things should work, but would rather see a working example and where it should be executed in the rendering process.
I have also been reading about the order of UnLoad events; Control UnLoad events followed by Page UnLoad event which does hold some promise.
At this point I would just be speculating about it working until I get to work tomorrow and try some empirical testing.
PS - I have looked into the documentation about IPostBackDataHandler and IPostBackEventHandler. Thanks for the suggestion. It is not really clear where this code should reside which is typical of MSDN. If you have a working model please post a code snippet also.
|
|
|
|
|
JimmyRopes wrote: It is not really clear where this code should reside which is typical of MSDN.
You should check into you're apparent superiority complex.
Since you consider yourself to be better than anyone else you shouldn't need to be asking questions here. You should be the one writing the documentation and articles.
JimmyRopes wrote: A look at your profile reveals that you are undoubtedly good at taking tests but that just means that you are good at taking tests, nothing more.
A class act to critize the skills of others when you can't solve a problem. It shows excellent character.
JimmyRopes wrote:
I gain my knowledge the old fashioned way, through empirical (unit) testing.
Prove it. Post some articles, show us what you have learned.
You're just not worth the time so go away and solve this problem the old fashioned way, after all isn't your're motto "if want something done right, do it yourself."
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: JimmyRopes wrote:It is not really clear where this code should reside which is typical of MSDN.
You should check into you're apparent superiority complex.
Since you consider yourself to be better than anyone else you shouldn't need to be asking questions here. You should be the one writing the documentation and articles.
Now you are really being a ass. I ask questions here when I have a problem I am having difficulty solving.
I am not better than anyone else and am willing to learn from anyone who has knowledge of a subject, not people like you pretending to know.
Mark Nischalke wrote: A look at your profile reveals that you are undoubtedly good at taking tests but that just means that you are good at taking tests, nothing more.
A class act to critize [sp] the skills of others when you can't solve a problem. It shows excellent character.
Actually asking a question when I don't know the answer does show at least good character.
My having a problem and asking about it here speaks volumes about what I think of others. As I said before I am willing to learn from anyone with knowledge.
I was willing to give you the benefit of the doubt until you started on a diatribe.
As I have stated before your response asking if I was theorizing before asking if I had actually tried to implement what I was asking about was arrogant. I don't have any patience with arrogant people like you.
Mark Nischalke wrote: JimmyRopes wrote:I gain my knowledge the old fashioned way, through empirical (unit) testing.
Prove it. Post some articles, show us what you have learned.You're just not worth the time so go away and solve this problem the old fashioned way, after all isn't your're motto "if want something done right, do it yourself."
I would like nothing more than to post articles but I happen to work professionally and sign confidentiality contracts which prevent my publishing work done for my clients.
PS - thanks for the 1 vote on my previous post. It just shows that you are petty as well as arrogant.
|
|
|
|
|
A quick test seems to work fine for me. Though I'm sure you will find something wrong since it won't live up to your high standards.
public class DDLWebPart : WebPart
{
protected override void CreateChildControls()
{
base.CreateChildControls();
Button btn = new Button();
btn.Text = "Click Me!";
Controls.Add(btn);
DropDownList ddl = new DropDownList();
ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
for(int x = 0; x < 10; x++)
{
ListItem item = new ListItem("Item " + (x + 1), (x + 1).ToString());
ddl.Items.Add(item);
}
Controls.Add(ddl);
}
public void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
Label lb = new Label();
lb.Text = ((DropDownList)sender).SelectedItem.Text;
Controls.Add(lb);
}
}
only two letters away from being an asset
|
|
|
|
|
And this ddl_SelectedIndexChanged fired when the button was clicked?
did you check the SelectedIndex? Was it -1?
|
|
|
|