The whole DataList control (ascx file) is enclosed in an UpdatePanel in the parent control - and I am having the problem that I already mentioned. Do you mean that I need to use an ashx handler? If so, any ideas how I might go about writing that? thanks, Dave
Dave25600
Posts
-
Using Javascript to fire an event in another class....? -
Using Javascript to fire an event in another class....?I want to be able to raise an event without actually clicking on the image buttons - which is why I am including buttons that do nothing but raise the event when the image button is hovered over. -- I've now managed to highlight the node by hovering over the image button using the line of code from the previous post (below). document.getElementById('<%=btnMouseOutCheat.ClientID %>').click(); Only as before, the mouseover event is continually raised when this happens - when I only really want to fire the event once on mouseover and again with mouseout. Any ideas anyone? -- modified at 9:16 Friday 26th October, 2007
-
Using Javascript to fire an event in another class....?Hi, I'm currently working on a website that has a treeview that represents folders in a virtual directory and also a datalist that allows users view files in a given folder, or text search, etc. I am using ASP.NET and C# and hope to implement a function where if the mouse is hovering over an imagebutton in the datalist - the folder for that given file will be highlighted in the TreeView. The TreeView and DataList are kept in diffent controls (ascx files) so I have been using EventHandlers in trying to solve my problem. Also, as far as I can tell - ASP.NET does not contain an 'onmouseover' attribute for ImageButtons so I have been using JavaScript to detect and fire the event. The DataList is kept in its own control, which is then placed into its parent control that also holds the TreeView. There is a lot of code so I will try and submit the code that I think is relevant: DataList Control.aspx: (javascript) function highlightNode(event) { javascript:setTimeout('__doPostBack(\'<% =btnCheat.ClientID %>\',\'\')',0) // alert(event); } function mouseOut(event) { javascript:setTimeout('__doPostBack(\'<% =btnMouseOutCheat.ClientID %>\',\'\')',0) //alert("mouseOut") } This is where I believe I may be going wrong - the setTimeout means that the highlightNode function is repeatedly called with onmouseover, could someone advise on how to rewrite this diffently so that it does not repeatedly call a method? The post backs called on each of these functions simulate the clicking of asp:buttons that will enable me to access the code-behind from the onmouseover event, here is the code-behind for the DataList control. DataList.ascx.cs: imgBtnFileType.Attributes["onmouseover"] = "highlightNode('" + HoverID + "')"; imgBtnFileType.Attributes["onmouseout"] = "mouseOut(event)"; These attributes are added in the ItemDataBound method for the DataList, where I add onmouseover and onmouseout to my image button. HoverID is the value I am passing to the event and is a ViewState variable that will be used to identify the Folder that I wish to highlight. protected void btnCheat_Click(object sender, EventArgs e) { RaiseMouseOverEvent(); } protected void btnMouseOutCheat_Click(object sender, EventArgs e) { HoverID = 0; RaiseMouseOutEvent(); } Above are the events called when I simulate a button click with my javascript. public EventHandler evtMouseOver; public EventHandler evtMouseOut; Again, I am using Even
-
Problem with focus when using UpdatePanel and UpdateProgressSorry I can't figure out how to post html on here, still hope to get some feedback on my problem
-
Problem with focus when using UpdatePanel and UpdateProgressHi, I am using AJAX to dynamically produce a DataList according to the input in a TextBox. I am using the 'OnTextChanged' event to achieve this and a problem that occurs is that I will lose focus in my TextBox as soon I begin to type anything. An easy solution for this would be to remove the TextBox from the UpdatePanel but as I am using the UpdateProgress to produce a neat loading gif each time the OnTextChanged event occurs I have to keep the TextBox inside the UpdatePanel right? I have seen a number of examples on the net which suggest using the LastFocus property but have had no luck getting that to work. Am I right in thinking that my problem cannot be solved with the LastFocus property as I also have an UpdateProgess in my code? I am very new to ASP.NET and would highly appreciate any advice with this - my code is fairly large so I'll enclose a snippet of it, that will hopefully make my problem a bit clearer: asp:TextBox ID="txtSearch" OnTextChanged="txtSearch_OnTextChanged" AutoPostBack="true" runat="server">
-
IE7 and Firefox appearance conflictHi, I'm fairly new to CSS and was wondering if anyone could help me. I am working on a web application that will allow a user to view PDFs and other files within the current webpage. I have managed to achieve this by using an asp:Literal to call a given PDF file stored in a database using a dynamic html string. I had no problems with this until I looked at my page in Firefox. As I am using a coloured background for my page, Firefox will display the given file only the rest of the container (if it is not filled) is now also coloured. I tried to solve this by applying a white background to the container with equal width and although it fixes the problem in Firefox, IE7 now displays a white rectangle even when there is no file on display. Giving the container an 'auto width' or similar did not work, this resulted in only part of files such as PDFs and docs being displayed. I would appreciate any tips/advice as to how to deal with this problem. Please forgive me if I am not being clear enough, I find articulating these problems as hard as solving them. thanks, Dave Maybe one day I'll be posting the solutions...?
-
The equivalent of 'hello world' when it comes to custom events?!Hi, I'm new to asp.net and C# and am having problems understanding how to create custom events. I have looked at various sites and the most basic examples that I have been able to find are far too complicated for novices. The tutorials that I have found all seem to suggest that, to create custom events, I need to write delegates and event handlers to start with but they are unclear and not specific. Also, some of the code I have downloaded is dated and does not work with VS2005 and what happened to starting with the basics?! I.e. right from scratch. Does anyone know any sites/links that might be useful to me. Specifically, I want to be able to have to separate controls (ascx) linked to a parent control. Where one of the child contols contains a textBox and a button to submit text which will make the said text appear in the label of the other child control. Any help truly appreciated, Dave