I have a page where I have a button and a read only text box, and the button uses javascript to open a popup window with a date picker on it, which is used to set the text box. Here is my button code:
There are a couple of things going on in this post:
1. The DropDownList (DDL) reverts back to index = 1 on postback (this has been solved, post #10) 2. Use of General Lists to populate the DropDownList (Post# TBD)
I have a series of DropDownLists (DDLs) one depending on the other for its selection value. The first one specifies the table name. On the SelectedIndexChanged event of the table name DDL the second DDL is populated with a list of field names contained in that table. And the third DDL with unique values contained in the selected field (In case you are wondering I am building a custom query tool).
The problem is that the Field names DDL, after selecting a new field, reverts to the second field listed in the table, something to do with the postback I would presume. The interesting thing is that it does not happen for the Table name DDL, though I am doing something a trifle bit different there.
I'll include the code for the three DDLs and the two SelectedIndexChanged events.
've programmatically created a listview, for displaying images. When you click on the download the ItemCommand is fired, and the browser sends the user the image as a binary response, using the following:
I'm trying to implement a custom principal and custom identity in a .NET MVC website. I've created a custom principal class which inherits from IPrincipal and a custom identity which inherits from IIdentity.
When a user logs in I set both Thread.CurrentPrincipal and HttpContext.Current.User to my custom principal. When I view either through the debugger the values are set with all the properties.
However once the request is complete and I try and request any other pages both Thread.CurrentPrincipal and HttpContext.Current.User are of type System.Security.Principal.GenericPrincipal and not my custom principal.
Do I need to do anything "extra" to get my custom principal out of the thread or HttpContext?
In my database I have boolean column to declare if something is 'active'. In my web application I would only like one item to be able to have the 'active' status at once.
Therefore I have a radio button list in my aspx page to force the user to select one item. I know it is easy to set the selected item to true through my SQL update statement, but how do I automatically set everything else back to false/null!?
I am using the agility pack to do some screens scraping and my code so far to get titles is:
foreach (HtmlNode title in root.SelectNodes("//html//body//div//div//div[3]//div//div//div//div[3]//ul//li[1]//h4")) { string titleString = "<div class="show">" + title.InnerText + "</div>"; shows.Add(titleString); }
Before the title I want a timestamp related to the title and it has the node /html/body/div/div/div[3]/div/div/div/div[3]/ul/li[1]/ul/li/span. How can I get this value next to the title? So something like: string titleString = "<div class="show">" + time.InnerText + " - " + title.InnerText + "</div>";
HtmlNodeCollection cols = doc.DocumentNode.SelectNodes("//td[@width='186']");<br /> foreach (HtmlNode col in cols)<br /> { if (col.InnerText == "Text1") { Label1.Text = col.InnerText; } }
The reason why i have the if-condition is because there are more td's in the page. And i need to specifically pick out the one who got "Text1" in it. But the problem is how i can parse out the text "? - ?" There are more text in the document also having the text "? - ?" but i need to pick out specifically the one between my two other nodes. The result should be Text1 ? - ? Text2 etc. I guess it has something to do with nextchild or sibling etcetera?
We are developing a web site and in this site we have a link to a clickonce deployed application. This is a direct link to the executable (Remote share execution). For this to be possible the client must have .NET framework SP2 installed. The problem is i need to get the SP version of the clients machine. I can access client information using Request.UserAgent but this doesn't have a clue about the service pack.
I am creating an HTML document using HTML agility pack. I load a template file then append content to it. All of this works, but when I view the output file it has removed the closing tag from my <br/> tags to look like this <br>. What is causing this?
Dim doc As New HtmlDocument() doc.Load(Server.MapPath("Template.htm")) Dim title As HtmlNode = doc.DocumentNode.SelectSingleNode("//title") title.InnerHtml = title.InnerHtml & "CEU Classes" Dim topContent As HtmlAgilityPack.HtmlNode = doc.GetElementbyId("topContent") topContent.InnerHtml = html.ToString doc.OptionWriteEmptyNodes = True doc.Save(outputFileName, Encoding.UTF8)
More info:
It was removing my closing image tags, after I added doc.OptionWriteEmptyNodes = True, it quite doing that.
How can I loop through table and row that have an attribute id or name to get inner text in deep down in each td cell? I work on asp.net, c#, and the newest html agility package.
An html file have several tables. One of them has an attribute id=main-part. In that identified table, there are many rows. Some of those rows have same attribute name=display. In those named rows, there are many columns which I have to extract text from. Something like this:
I want to parse and page that takes POST parameters. like this is my scenario. i have to parse some search results. but the search parameter are sent in post body to that page. To parse the search result i have to send parameters to that page in POST. how i can do that with agility pack ?
I want to execute my asp.net application where Windows XP Service Pack 3 is installed + VS 4.0 framework is installed and IIS 5.1 is installed. The program is not running yet. It shows me an erro message that "Server is unavailable" Is it possible to run the application on this machine. I also tried aspnet_regiis -i and -c command
I am attempting to replace this god awful collection of regular expressions that is currently used to clean up blocks of poorly formed HTML and stumbled upon the HTML Agility Pack for C#. It looks very powerful but yet, I couldn't find an example of how I want to use the pack which, in my mind, would be a desired functionality included in it. I am sure I am an idiot and cannot find a suitable method in the documentation. I had the following html:
<p class="someclass"> <font size="3"> <font face="Times New Roman">[code]....
When I utilize the HtmlNode.Remove() method it removes the node plus all it's children. Is there a way to remove the node preserving the children?
I am using the ToolkitScriptManager from the Ajax tool kit and I am having a problem finding my button's ID.My ID's on my controls come back with $ symbols instead of _ symbols, like the following:causes problems when attempting to find the control from the Page.Request.Form keys. I cannot seem to find the determining factor that would cause this.Now, I know this is the name and in my source I see that the ID is with the _, so why is the Page.Request.Form showing up with the $ symbol instead? Anybody encounter this before?
I have a textbox and a button. On page load I select one column from one row and put its value in the textbox. I have a button click method that updates the same column/row with the new value in the same textbox.
The problem i'm having is that when I clear the text in the text box, type in new data and hit submit the new text value is not being saved, it uses the old one.
I put a breakpoint at the end of my button click method and it appears that asp.net is sending the old value of the textbox rather than the new one I put in. I'm totally stumped.
In answering another persons question here on SO, I discovered that there is a small "bug" in my global redirect code.I have wired up a Global class to an HttpModule. It's job is to detect "http:/www." in the URL and redirect the user to the NON www. version
Protected Sub OnBeginRequest(ByVal sender As Object, ByVal e As EventArgs) 'Force Removal of WWW Dim application As HttpApplication = TryCast(sender, HttpApplication) [code]....
when it redirect a page http://www.example.com/AboutUs, the goal is to have it go to http://example.com/AboutUs (the rewritten page) but instead it's going to http://example.com/Default.aspx?Slug=AboutUs (the original page).I tried doing a bit of a hack by changing
Dim newUrl As [String] = UrlRegex.Replace(url.ToString(), [String].Format("{0}://", url.Scheme)) application.Context.Response.Status = "301 Moved Permanently" application.Context.Response.AddHeader("Location", newUrl.Replace("Default.aspx", "")) to
Dim newUrl As [String] = UrlRegex.Replace(url.ToString(), [String].Format("{0}://", url.Scheme)) newUrl = newUrl.Replace("Default.aspx?Slug=", "") newUrl = newUrl.Replace("Default.aspx", "") application.Context.Response.Status = "301 Moved Permanently" application.Context.Response.AddHeader("Location", newUrl)
not something I want to do anyways since it's a hack, but it didn't work anyways.
The things I need to change are in my default.aspx file. First, at the bottom of my pages it has the name of the company that created the site for us. I want that taken off our site. I know it is a matter of going into the default.aspx file and removing the wording, but I cannot figure out how to go into it and change it.
Also in our default.aspx file, on line 167 and 168 there is a reference to the slideshow that is on our front page. There is a string missing that should point to our last two images, but again, I am unable to get into the default.aspx to edit it.
Evidently when our site was created, the developers used the precompilation tool so now I am unable to edit any of the files when I try to upload them into visual studio. Whenever I try to uplaod them I get the error "This is a marker file generated by the precompilation tool, and should not be deleted!"
I do have all of the original source files for the site, but as you know there are alot of them and I am not sure where to find the original default.aspx file or even what it would be named so I can make the changes to it. Also, once the changes are made will I have to precompile the entire site again, or can I just do the default.aspx and uplaod it to the server?