Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

John Petersen

@John Petersen
About
Posts
15
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to compare time?
    J John Petersen

    You can also compare to DateTime values and the result is a TimeSpan DateTime date1 = DateTime.Parse("2006-06-01 08:32"); DateTime date2 = DateTime.Parse("2006-06-01 13:54"); TimeSpan span1 = date2 - date1; -- modified at 9:20 Saturday 21st October, 2006

    Kind Regards, John Petersen

    ASP.NET tutorial question

  • custom error
    J John Petersen

    The problem is propably the casing of the word statuscode, it should be statusCode

    haytham_mohammad wrote:

    Line 29: --> Line 30: Line 31: Line 32: Line 33:

    Kind Regards, John Petersen

    ASP.NET help question

  • Div Mod SQL
    J John Petersen

    select * from [TableName] where time % 5 = 0 Kind Regards, John Petersen

    C# database

  • File System (about stream reader)
    J John Petersen

    You propably need to restart the iis before you can operate on the file again.

    Kind Regards, John Petersen

    C# help csharp asp-net

  • Data bind on Contained Object Properties
    J John Petersen

    Hello Could you provide the code for the Collection class Cars? This would make it easier to help you.

    Kind Regards, John Petersen

    C# tutorial question

  • Regex.Replace Chr(10)
    J John Petersen

    Ok Jie Liang As guffa said, you should mark the Ignore Html option when posting code here. I tried to set up a test case which resembles your code. It works for me. I post the code here. using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; using System.Text.RegularExpressions; namespace Tester { [TestFixture] public class Class1 { public string Process(string[] pageText) { Regex tag = new Regex("<[^>]*>", RegexOptions.IgnoreCase); //This was suppose to help me get rid all the HTML text which it works in VB.NET and don't seems to work in C# int counter; for (counter = 0; counter <= pageText.Length - 1; counter++) { string str = Regex.Replace(pageText[counter].ToString(), "
    ", "\n"); str = tag.Replace(str, ""); str = Regex.Replace(str, " ", ""); // By this line, all the HTML text should be alredy gone str = Regex.Replace(str, "^\\s+", ""); str = Regex.Replace(str, "\\s+$", ""); pageText[counter] = str; } return pageText[0]; } [Test] public void TestFunc() { string[] PageText = { "Notify me by e-mail if someone answers this message" }; Process(PageText); } } } The output from the Process method is "Notify me by e-mail if someone answers this message" Kind Regards, John Petersen

    C# csharp help html regex

  • Windows service
    J John Petersen

    Hello You will have to write the service from scratch. Take a look at the following link for a little help. http://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/ServiceApplication/SimpleService/SimpleService.src&file=CS\SimpleService.cs&font=3[^]

    Kind Regards, John Petersen

    C# csharp

  • Regex.Replace Chr(10)
    J John Petersen

    Hello To convert that to C# will result in. string str = Regex.Replace(SomeString, "
    ", "\n"); Remember to include using System.Text.RegularExpressions; in the top of the file. Kind Regards, John Petersen

    C# csharp help html regex

  • Enum in C#
    J John Petersen

    Hello You could create a property of the enum1 type

    public enum enum1{ f1=0, f2=1, f3=2, f4=3}

    private enum1 myEnum1;

    public enum1 MyEnum1
    {
    get ( return myEnum1; }
    set
    {
    if (value == f1 || value == f3)
    myEnum1 = value;
    else
    throw new ArgumentException("Invalid assignment");
    }
    }

    Otherwise you could create different enums

    public enum enum1{ f2=1, f4=3}
    public enum enum2{ f1=0, f3=2}

    for example.

    Kind Regards, John Petersen

    C# question csharp

  • Gridview TemplateField
    J John Petersen

    Hello ma se There are different ways of doing this. One way is to create a method in the code behind file that returns the value that you want to display. So you replace your "Insert / Update Items" part with a method call as the sample below. You can send any data to this method for it to be able to return the right value. Remember to make the method protected, otherwise you cant use it from the aspx page. [<%# GetUrlActionText( DataBinder.Eval(Container.DataItem, "ID") %>](UpdateOrderItems.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "ID") %>) // Put in code behind file protected string GetUrlActionText(string id) { // Code to return either Insert / Update Items or View bool isOrdered = GetOrderIsPlaced(id); if (isOrdered) return "View"; else return "Insert / Update Items"; } Another way is to make the check in the aspx file. <% if (orderPlaced == true) { %> [View](UpdateOrderItems.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "ID") %>) [Insert / Update Items](UpdateOrderItems.aspx?OrderID=<%# DataBinder.Eval(Container.DataItem, "ID") %>) <% } %> the orderPlaced variable is a protected variable in the code behind class that contains the state of the order. I hope this helps you out. Kind Regards, John Petersen

    ASP.NET csharp asp-net docker question announcement

  • form submit using javascript
    J John Petersen

    You could do something like this.

    Response.Write("function doSubmit(){var form = getElementById('" + AspButton.ClientID + "'); form.submit(); }");

    This will first get the form object and then call the submit() function on it. Assign a call to this funtion on the buttons onClick event and you are home free.

    Kind Regards, John Petersen

    ASP.NET csharp javascript asp-net

  • custom server control problem
    J John Petersen

    Hello again I think i know what is wrong. The ContainerControlDesigner is used to create a designer that can contain several controls. Maybe you should derive from CompositeControlDesigner instead? i found a sample of this here Kind Regards, John Petersen

    ASP.NET help csharp visual-studio sysadmin debugging

  • DateFormat
    J John Petersen

    Hello Nagaraju I think there is no way to automatically do this. You could check the input manually, but you will have to choose a standard way of interpreting, because if the user enters 09/08/2006 it could be interpreted both ways. Kind Regards, John Petersen

    .NET (Core and Framework) csharp help tutorial

  • custom server control problem
    J John Petersen

    Hello Jürgen Im not sure why you get this error, but propably the type is not right. Use a type safe cast instead and call the base class if the cast is not successful. public class MyDesigner : ContainerControlDesigner { public override string FrameCaption { get { MyComponent c = base.Component as MyComponent; if (c != null) return "MyComponent - " + c.MyProperty; else return base.FrameCaption; } } Kind Regards, John Petersen

    ASP.NET help csharp visual-studio sysadmin debugging

  • How can I display an animated progress bar during asp upload?
    J John Petersen

    Hello I think what you need is to flush the response object, using Response.Flush() after adding the animated stuff. This will output the html to the browser, while you can continue to do more processing on the server side. Kind Regards, John Petersen

    Web Development help question html sysadmin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups