Mideoan's Profile User Rating: -----

Reputation: 4 Apprentice
Active Members
Active Posts:
77 (0.06 per day)
31-May 11
Profile Views:
Last Active:
User is offline Feb 20 2013 11:54 AM

Previous Fields

Dream Kudos:
Icon   Mideoan has not set their status

Posts I've Made

  1. In Topic: ItemDataBound event when using HyperLinkColumn

    Posted 20 Feb 2013

    Found a solution. If anyone wants to reference this in the future, this was what I did.

            protected void grdOrders_ItemDataBound(object sender, DataGridItemEventArgs e)
                if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
                    HyperLink hl = e.Item.Cells[5].Controls[0] as HyperLink;
                    if (hl.Text.Contains("1Z"))
                        hl.NavigateUrl = "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=" + hl.Text.ToString();
                        hl.NavigateUrl = "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=" + hl.Text.ToString();

    Detects if it is UPS or USPS and links website passing query string of tracking number.
  2. In Topic: Calculated Split()

    Posted 19 Jan 2013

    Great long term solution. I've only seen regex validation in some already written code, so this will be new for me to explore. Based on some quick googling, it seems pretty easy and straight forward. Thanks for the alternate solution. :)

    View PosttlhIn`toq, on 19 January 2013 - 10:15 AM, said:

    You might consider looking into Regular Expressions or RegEx. That way you can obtain everyting between the two hyphens easily without hardcoding the positioning of 2 and 6. Its nice to have your programs be dynamic and forward thinking so they continue to work uninterupted even when the guy changing the database or numbering system goes from
    N-010012-S to N-123456789987654312-S

    It looks really good to your boss when they walk up to you and have this exchange:


    Boss: You need to make some changes to your program to accommade the new numbering scheme.
    Developer: No problem. I'm already done. The program doesn't care how many digits are between the hyphens.

    For this reason you probably want to make a method
    string GetPartNumber(string LongerCode)
       // Do all the stripping and formatting here
       return justThePartNumber;

    This way you don't have 100 places in your code that does the extraction. We never duplicate purpose if we can avoid it. Using a method to do this means you only have to make changes in one place if the scheme ever got more complex like N-AS-1564-F00-BARR
  3. In Topic: Calculated Split()

    Posted 19 Jan 2013

    View Postandrewsw, on 18 January 2013 - 07:24 PM, said:

    If the product numbers are of a set length I believe you could use:

    Dt.columns.add("ProductnumSplit", typeof(string), "SUBSTRING(ProductNum, 2, 6)");

    You could convert to integer but you would lose the leading zeroes.

    Works perfect for my purpose. Thank you for the work around. +rep :)

    View Postpharylon, on 18 January 2013 - 08:10 PM, said:

    OK, I'm a total noob, but why not

    ProductNum.Replace("-", "")

    Thanks for the contribution. Why this wouldn't work for my purpose is because I needed to get rid of the leading letter and the dash as well as the ending dash and letter.

    For example, take "N-010012-S". I just needed the number striped out to look like "010012", where as the replace would make it N010012S.

My Information

Member Title:
D.I.C Head
Age Unknown
Birthday Unknown

Contact Information

Click here to e-mail me


Mideoan hasn't added any friends yet.


Mideoan has no profile comments yet. Why not say hello?