Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. Heh, you mean parseFloat(). The link goes to the right place though.
  2. As far as I know, the answer to your question is no. It is not possible to do this to render a LinkButton to the page: myLabel.Text = "blah blah blah <asp:LinkButton ID=\"SomeLinkButton\" runat=\"server\" />"; Your label will simply read "blah blah blah <asp:LinkButton ID="SomeLinkButton" runat="server" />" and the server tag won't ever be built.One trick I've discovered when I've come across situations like yours is to view the source code that is rendered and see what .NET is doing with my code. The reason I think this would help you is that you can sort of trick .NET into thinking that a PostBack has occurred by writing your own onclick event into the links.Try this. Put the following in a page and render it out to the browser: <asp:Label id="myLabel" runat="server">blah blah blah <asp:LinkButton id="myLinkButton" OnClick="myLinkButton_Click" runat="sever" Text="Page 2" /> blah blah</asp:Label> The code that is sent to the browser will look something like this: <span id="myLabel">blah blah blah <a id="myLinkButton" onclick="__doPostBack('myFormName$myLinkButton');">Page 2</a> blah blah</span> So, rather than have .NET write the rendered code, you can try to write it yourself. This way, you can dynamically set the Text for your Label like so: myLabel.Text = "blah blah blah <a id=\"myLinkButton\" onclick=\"__doPostBack('myFormName$myLinkButton');\">Page 2</a> blah blah"; Of course, this is a total hack and, as such, you'll most likely have to play around with it a bit to get it to work correctly for you. I've used it a number of times to great advantage.
  3. You can get at the query string parameters with javascript, it's just much easier to do it with a server-side technology.You could either write your own method of getting the variables out of the query string staring with something like this: var query = location.search;var pairs = query.split("&"); Or, you can use a method that aspnetguy posted here awhile ago:http://w3schools.invisionzone.com/index.ph...ost&p=49133
  4. Me too, Prateek. I've only read one book on javascript (it was an O'Reilly book), the rest I've learned from playing and from reading online.
  5. Hah! So IE doesn't allow you to extend the HTMLElement, but it doesn't have any problems with you completely overriding document.createElement and document.getElementById!? All I can do is shake my head...Nice work, aspnetguy.
  6. jesh

    track uploads?

    That's right. In order to keep track of who is visiting a certain page, you have to store that person's UserID in either the Session or in a cookie. Then, when it comes time to save the file, you look at the Session (or cookie) to get the UserID and then you can insert a record in the database with the filename and the user's UserID.
  7. I don't know, I haven't downloaded that virus yet.
  8. jesh

    track uploads?

    Are you allowing them to upload files by presenting them with a form that has an input of type file and posts to some ASP page? <form action="upload.asp" method="POST" enctype="multipart/form-data"><input type="file" id="uploadFile" /><input type="submit" value="Upload the file!" /></form> Or are you providing them access to your site through an FTP program?If you are using ASP, are you keeping track of who is viewing the page? Either by placing a cookie on that person's computer or using Sessions?
  9. Yeah, that's right since you aren't able to control the consumers. I would guess that you would minimize errors if the structure of the date in the request looked something along the lines of:<date> <month>3</month> <day>14</day> <year>2007</year></date>
  10. I've suddenly become interested in learning more about this. heh.Here's a sample of an entire Web.sitemap file. I believe that the only elements allowed are siteMap and siteMapNode: In siteMap, there can be only one siteMapNode, but there can be many siteMapNode elements within that first siteMapNode and you can nest more siteMapNodes in the children siteMapNodes.I think, for the sake of future compliance, you're probably corrrect that the best bet would be to simply write your own sitemap XML file and use XSLT to transform it into the format you need rather than rely on .NETs .sitemap file structure.
  11. jesh

    track uploads?

    Are you currently already storing the file names and user ids in your database? How are your users able to upload files and are they then able to view those files at a later time? If so, all the data that you need is probably already there. Give us some more information about your database structure and describe in more detail the process you are using to allow the users to upload files and we may be able to help.
  12. Yeah, I just ran into IE's little prevention yesterday on a different project. Punks. I wanted to add an addEventListener method to HTMLElements so that I could do it in a cross-browser way (rather than use addEventListener in DOM Compliant browsers and attachEvent in IE). So, I ended up doing what aspnetguy did - I wrote a stand-alone function.Instead of element.addEventListener("click", myhandler), I have to call addEventListener(element, "click", myhandler).
  13. Maybe it's the way you are passing the date. Many database management systems store dates in the YYYY/MM/dd format. Try this query:INSERT INTO emails (email,[date]) VALUES ('admin@enterf2.co.uk','2007/03/13') EDIT: Also try "2007-03-13".
  14. jesh

    CSS IE issue help

    Rather than messing around with positioning, you might consider using float.HTML: <body><div id="container"> <div id="menu">....</div> <div id="content">...</div></div></body> CSS: #container { padding-top: 266px; }#menu { float: right; width: 170px; }
  15. jesh

    huh?

    Just to add to the discussion:FTP = File Transfer ProtocolHTTP = HyperText Transfer ProtocolFTP and HTTP are two standards that computers on the Internet use to communication with one another. One protocol is for transferring files, another is for transferring hypertext (i.e. web pages).
  16. jesh

    AJAX Question

    What is "str" for? Try passing the page href into the function:function changePage(page, str){ if (str.length==0) { document.getElementById("content").innerHTML=""; return; } xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } // Rather than set this to a specific page, set it to the page that is // passed in the parameters of the function: var url = page; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null);} Then call it on the page like this: <a href="about.php" onclick="changePage(this.href, '???????'); return false;">About</a>
  17. You might consider posting in the .NET forum. I am a .NET developer who doesn't know very much about XSLT but I happened to take a look at this forum yesterday. Perhaps one of the .NET developers here knows more about XSLT but also doesn't look at this forum much.
  18. jesh

    AJAX Question

    You could set up your links something like this:<a href="page2.html" onclick="loadContent('page2.html'); return false;">Go to page 2!</a> This way, if javascript is enabled on the browser, the loadContent function would run - this could be your AJAX loader code - and the "return false" will prevent the link from directing the users to page2. However, if javascript were disabled, the onclick would never fire and the page would simply go to page2.EDIT: To save some hassle, you could set up your links like this: <a href="page2.html" onclick="loadContent(this.href); return false;">Go to page 2!</a>
  19. I've seen it mentioned a number of times in this forum that the only reliable way to capture date input from users is to set up three fields: one for month, one for day, and one for year. Whether this fields are text fields or drop down menus would be up to you. Another alternative would be to find yourself a calendar control that you could put on your page that would allow a user to select a date from the calendar and have that calendar return the date to your script in a standardized format.
  20. I, actually, meant to say "HttpHandlers" rather than "PageHandlers" - woops! You can set up an HttpHandler in your Web.config like so:<system.web> <httpHandlers> <add verb="POST,GET" path="*.xml" type="MyNamespace.MyXMLHttpHandler,MyDLLName" /> <httpHandlers></system.web> That would make it so that any request that came in for an XML file would be processed by the MyXMLHttpHandler class - the skeleton of that class would look something like this: using System;using System.Web;using System.Xml;namespace MyNamespace{ public class MyXMLHttpHandler : IHttpHandler { #region IHttpHandler Members public bool IsReusable { get { return true; } } // This is the nitty-gritty of the handler. public void ProcessRequest(HttpContext context) { // You can set the content-type of the request: context.Response.ContentType = "text/xml"; // or perhaps "application/rss+xml" // You can write directly to the output context.Response.Write("<xml>some xml</xml>"); // Or, you can get access to the output stream and use an XmlWriter XmlWriter writer = XmlWriter.Create(context.Response.OutputStream); } #endregion }} I don't know if this is exactly what you're looking for, but knowledge of HttpHandlers (and HttpModules) can come in very handy.
  21. Something like this? (C#): // This is the Click handler for the first LinkButtonprotected void Button1_Click(object sender, EventArgs e){ // Create the LinkButton and set its properties LinkButton button2 = new LinkButton(); button2.ID = "Button2"; button2.Text = "I am dynamic!"; button2.Click += new EventHandler(Button2_Click); // Add the LinkButton to the control with an ID of "Label" Label.Controls.Add(button2);}// This is the Click handler for the second LinkButton (that we added)protected void Button2_Click(object sender, EventArgs e){ Response.Write("You clicked the second, dynamically added, LinkButton!");}
  22. jesh

    Uploading video file

    There's bound to be a converter out there. I did a Google search and came up with this:http://www.bytescout.com/swfscout_flash_demo_avi_to_swf.htmlMaybe it'll help.
  23. It looks like you already know about the setTimeout function, you can use that, in addition to a counter, to make the wheels spin. Just use the setTimeout to call the function over and over again in a loop: var spins = 20;function spin(){ var testImage1 = document.getElementById("drum1"); testImage1.src = imageSources[randomNumber()]; spins--; if(spins > 0) { setTimeout("spin();", 50); }}
  24. I probably would have written PageHandlers to deal with the different content types, but there are always more than one way to do something! I just want to give one more piece of advice - You can get the child nodes of any SiteMapNode like so:SiteMap.CurrentNode.ChildNodes If you are currently on "AboutUs", and "AboutUs" has a child node of "AreaLinks", then the return value of SiteMap.CurrentNode.ChildNodes is a one-element, one-dimensional array of SiteMapNodes which contains the SiteMapNode for "AreaLinks". This might be an easier way than parsing the entire XML file on your own and looking for a specific ID.OK, carry on the XSLT discussion.
  25. So, I've sort of been following this one. Why exactly are you using XSLT for this? Are you just trying to create a link from your sitemap file? It seems to me that it'd be much easier to do something like this:MasterPage.master: ...<asp:HyperLink id="SiteMapLink" runat="server />... MasterPage.master.vb: ...SiteMapLink.Text = SiteMap.CurrentNode.TitleSiteMapLink.NavigateUrl = SiteMap.CurrentNode.Url... Of course, I could be totally wrong - I didn't even know that the SiteMap class existed. :)EDIT: If you are trying to build the entire navigation, these links may help:http://msdn2.microsoft.com/en-us/library/s...datasource.aspxhttp://msdn2.microsoft.com/en-us/library/w...8fw(vs.80).aspxThe gist of the code is like so:MasterPage.master: <form id="form1" runat="server"> <asp:SiteMapDataSource id="SiteMapDataSource1" runat="server" /> <asp:TreeView id="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"> </asp:TreeView> </form>
×
×
  • Create New...