Lat/Lon Custom Editor

2 posts, 0 answers
  1. Kenneth
    Kenneth avatar
    10 posts
    Member since:
    Jul 2010

    Posted 19 Dec 2011 Link to this post

    Hi,

    I have an application that has latitude and longitude values in cells in a GridView.  I need to have the user edit these values.  Currently, I have them as individual cells and the user can edit them individually by entering new values.  What I would like to do is extend this editing so that the values can be set by clicking a location on a globe.  The lat/lon value would then be returned via an event and the values in the cells updated accordingly.

    I'm not sure how to do his if I have separate cells for the lat/lon values.

    Does anyone have any suggestions on how to proceed?

    Thanks.


    Ken...
  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 21 Dec 2011 Link to this post

    Hi Kenneth,

    Thank you for writing.

    I am not quite sure in what format you will receive the data, but let's assume that you receive the following string - 10.12345, 20.98765. So in this case, you will know that the lat is 10.12345 and the lon is 20.98765. So as you see the data is separated by comma, so what you can do is to split the string by ',' and you will have the lan and lon separated. Then simply set the deisred cells values or add new row with them. For example if you have two columns in RadGridView, recpectively named "latitude" and "longitude" here is how to add row or change some cells values:
    string dataFromSomewhere = "10.12345,20.98765";
    string[] data = dataFromSomewhere.Split(',');
    string lan = data[0];
    string lon = data[1];
    radGridView1.Rows.Add(lan, lon);
    //or if you want to modify some row
    radGridView1.Rows[10].Cells["latitude"].Value = lan;
    radGridView1.Rows[10].Cells["longitude"].Value = lon;

    I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.

    Best wishes,
    Stefan
    the Telerik team

    Q3’11
    of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top