• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "GridView dot net question"

Collapse

  • suityou01
    replied
    Originally posted by DimPrawn View Post
    WHS.

    Don't follow their bad practices.
    I am contracted in at a senior level. I have tried to get them to listen. There are one or two machiavelis who are extremely ambitious and have tried to undermine me on many an occasion. Rather than clash, I have opted to let things fall down, and then help them rebuild with good grace. I guess a kind of damage limitation strategy.

    One outcome is that they will listen next time. Or the machiavelis might say I should have said something sooner.

    There is some shocking code in this place, and a huge disconnect between the senior management and the coders, so that they will believe whatever bulltulip they are fed. As a contractor, you get badmouthed you get sent down the road, period.

    Sometimes it's just better to STFU and go with it, and then invoice. It's not like I have a hell of a lot of choice atm.

    Leave a comment:


  • DimPrawn
    replied
    Originally posted by Weltchy View Post
    You need to look at contracts with a more senior role I think, where you can dictate the coding standards and practises to the junior developers. It sounds like you've in at a lower level, which, the way things are going, will get farmed out to India or similar.

    And, if you are being contracted as the more senior position, you should be forcing best practise onto these guys/gals
    WHS.

    Don't follow their bad practices.

    Leave a comment:


  • Weltchy
    replied
    Originally posted by suityou01 View Post
    It's life though. Sometimes you have to play it their way for a bit, then they see the error of their ways, and sell the idea back to you as if it's their own. You on the other hand chuckle as you raise your invoice.
    You need to look at contracts with a more senior role I think, where you can dictate the coding standards and practises to the junior developers. It sounds like you've in at a lower level, which, the way things are going, will get farmed out to India or similar.

    And, if you are being contracted as the more senior position, you should be forcing best practise onto these guys/gals

    Leave a comment:


  • suityou01
    replied
    Originally posted by Jaws View Post
    This thread is painful. This problem should have been solved within minutes by just creating a class to deal with it. I don't think I could face being in a contract where I had to tread so lightly that I could not produce a 20 line class in order to save hours of messing around trying to get a gridview to go against everything C# is all about.

    I have had people ask me in the past about how to manage things using multi-dimensional arrays as they wish to save time in writing classes. I tell them you don't and this thread is a fine example on why you will not save anytime using them.
    It's life though. Sometimes you have to play it their way for a bit, then they see the error of their ways, and sell the idea back to you as if it's their own. You on the other hand chuckle as you raise your invoice.

    Leave a comment:


  • DimPrawn
    replied
    Originally posted by Jaws View Post
    This thread is painful. This problem should have been solved within minutes by just creating a class to deal with it. I don't think I could face being in a contract where I had to tread so lightly that I could not produce a 20 line class in order to save hours of messing around trying to get a gridview to go against everything C# is all about.

    I have had people ask me in the past about how to manage things using multi-dimensional arrays as they wish to save time in writing classes. I tell them you don't and this thread is a fine example on why you will not save anytime using them.
    Yes, you start your contract and at about five weeks in the penny drops that the nested 14th dimension element in the array is the persons DOB.

    And then you wonder why you don't get renewed when you've only managed to fix three bugs in the 3 months.

    Leave a comment:


  • Weltchy
    replied
    Originally posted by DimPrawn View Post
    I see a lot of code that looks like this going to India to be further mangled as the cost of maintaining nasty badly designed spaghetti in the UK is too high.
    In all seriousness though, writing code like this is just being plain lazy.

    Leave a comment:


  • Jaws
    replied
    Originally posted by suityou01 View Post
    Edit : "Tread lightly" was the advice in a recent thread.
    This thread is painful. This problem should have been solved within minutes by just creating a class to deal with it. I don't think I could face being in a contract where I had to tread so lightly that I could not produce a 20 line class in order to save hours of messing around trying to get a gridview to go against everything C# is all about.

    I have had people ask me in the past about how to manage things using multi-dimensional arrays as they wish to save time in writing classes. I tell them you don't and this thread is a fine example on why you will not save anytime using them.

    Leave a comment:


  • Weltchy
    replied
    Originally posted by DimPrawn View Post
    I see a lot of code that looks like this going to India to be further mangled as the cost of maintaining nasty badly designed spaghetti in the UK is too high.
    Ah, good point.

    return (String)((String[])this.GetDataItem())[0];

    once its been indianized, would convert to

    return (((System.String)(((System.String)(((System.String )((System.String)((System.String[])((System.Object)this.GetDataItem()))[0])));

    With maybe a comment such as,

    /// Convert field To System String from String Array instance value, working very well, nicely yes!!!!

    Leave a comment:


  • DimPrawn
    replied
    Originally posted by Weltchy View Post
    Shush DP. Remember, unmaintainable and impossible to read code leads to longer as well as return contracts.

    Note - This of course relies on the client being thick as two short planks!!!
    I see a lot of code that looks like this going to India to be further mangled as the cost of maintaining nasty badly designed spaghetti in the UK is too high.

    Leave a comment:


  • Weltchy
    replied
    Originally posted by DimPrawn View Post
    You are just propogating a bad design.

    Create a class to represent the data. Create a constructor that will consume your mad array of strings. Bind the grid to a List<T> of these objects.

    Don't pass the array around your application. Get it into nice objects ASAP.
    Shush DP. Remember, unmaintainable and impossible to read code leads to longer as well as return contracts.

    Note - This of course relies on the client being thick as two short planks!!!

    Leave a comment:


  • suityou01
    replied
    Originally posted by Weltchy View Post
    I don't think that you will get the data binding to work against a multi-dimensional array. However, you could always change the code to

    <asp:TextBox id=blah runat="server text='<%# RenderMyField() %>'


    with RenderMyField in the Code Behind as

    protected String RenderMyField()
    {

    return ((Object)this.GetDataItem()).ToString();

    }

    Put a breakpoint onto the line with the return on it and see what type it shows as. It will probably be a multidimensional array, in which case you could explicitly refer to the fields as

    return (String)((String[])this.GetDataItem())[0];
    Spot on Weltchy. That then made me think of casting the Container.Item to a (string[]) which compiles ok.

    In the page load however,

    this line breaks

    gvLeagueTable.DataBind();

    With the error "Array was not a one-dimensional array."

    So it looks to be like it cannot be done.

    Leave a comment:


  • DimPrawn
    replied
    Originally posted by Weltchy View Post



    return (String)((String[])this.GetDataItem())[0];
    I'm sure the next person who has to extend the code will love you for all of this.

    Leave a comment:


  • Weltchy
    replied
    I don't think that you will get the data binding to work against a multi-dimensional array. However, you could always change the code to

    <asp:TextBox id=blah runat="server text='<%# RenderMyField() %>'


    with RenderMyField in the Code Behind as

    protected String RenderMyField()
    {

    return ((Object)this.GetDataItem()).ToString();

    }

    Put a breakpoint onto the line with the return on it and see what type it shows as. It will probably be a multidimensional array, in which case you could explicitly refer to the fields as

    return (String)((String[])this.GetDataItem())[0];

    Leave a comment:


  • suityou01
    replied
    Originally posted by DimPrawn View Post
    You are just propogating a bad design.

    Create a class to represent the data. Create a constructor that will consume your mad array of strings. Bind the grid to a List<T> of these objects.

    Don't pass the array around your application. Get it into nice objects ASAP.
    I agree. However this has become more of an intellectual challenge now. Clearly a datatable would do.

    I think I will have to go this one alone. If I find something out I will post back here.

    Edit : It was only because I was asked, and did not know the answer that made me go looking. I would of course use good application design if I had the authority. "Tread lightly" was the advice in a recent thread.

    Leave a comment:


  • DimPrawn
    replied
    Originally posted by suityou01 View Post
    Interesting thought. The underlying object is a string array, so it is numerically indexed. If the grid view needs a kvp this could be the problem.

    I guess it is whatever Container.DataItem actually is. Can't step through as it's markup though.

    Back to google.
    You are just propogating a bad design.

    Create a class to represent the data. Create a constructor that will consume your mad array of strings. Bind the grid to a List<T> of these objects.

    Don't pass the array around your application. Get it into nice objects ASAP.

    Leave a comment:

Working...
X