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

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

Previous Fields

Dream Kudos:
0
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();
                        
                    }
                    else
                    {
                        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:

    Quote

    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.
  4. In Topic: Dropdownlist selectedvalue when set to another value ignored

    Posted 13 Dec 2012

    I'm going to have to chalk this up to a visual studio fluke. I shut down visual studio when I left work yesterday, came back in this morning, fired it up, walked through the code and it worked fine.

    Ugh! Lol at least it wasn't an issue that I fought over for days.

    Thanks for trying to help!
  5. In Topic: Timer.Enabled running in debug mode, but not firing the event.

    Posted 12 Dec 2012

    Perfect. Thanks for the explanation. I will keep this in mind while I continue to develop. :) One of those things you just don't know about until you come across it!

My Information

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

Contact Information

E-mail:
Click here to e-mail me

Friends

Mideoan hasn't added any friends yet.

Comments

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