This is a migrated thread and some comments may be shown as answers.

Caching + Getting Selected cell value using code behind

5 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aarsh
Top achievements
Rank 1
Aarsh asked on 12 Nov 2012, 02:26 PM
I've had posted my code snip in another forum : http://www.telerik.com/community/forums/aspnet-ajax/rotator/q3-2012-adds-border.aspx#2369096

  1. And I am wanting to figure out a way so that I can cache the result set being returned from the database, as I would be doing just the read operations & the data is not going to be updated per my application scenario.
  2. I also want to be able to retrieve the value of the first column of the selected row (cell selection should be disabled) in the code-behind. I looked at the help topics but could not find something that depicts same or similar to my query.

Thanks for your help,
-Aarsh

5 Answers, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 15 Nov 2012, 10:01 AM
Hi Aarsh,

Regarding your first questions: You could achieve your scenario by saving the returned data in a Session or ViewState variable as shown in the example below.
private DataTable Data
{
    get
    {
        object obj = Session["Data"];
        if (obj != null)
        {
            return (DataTable)obj;
        }
        // Instead of static creation of data you could
        // retrieve it once from the database.
        DataTable table = new DataTable();
        table.Columns.Add("Date");
        table.Columns.Add("Score");
        table.Rows.Add(DateTime.Now, 1);
        table.Rows.Add(DateTime.Now, 1);
        return table;
    }
}

Regarding your second questions: The first cell could be selected as shown below. Note that the firstColumnIndex could very and you should investigate and check which is the first column index.
int firstColumnIndex = 1;
TableCell cell = RadGrid1.SelectedItems[0].Cells[firstColumnIndex];

Kind regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Aarsh
Top achievements
Rank 1
answered on 15 Nov 2012, 04:09 PM
Thank you so much, Antonio ! Actually it was an urgent thing and hence I ended up using a default asp:GridView. Here are the details 
(http://forums.asp.net/post/5210077.aspx)

-Aarsh
0
Maria Ilieva
Telerik team
answered on 20 Nov 2012, 12:46 PM
Hello Aarash,

Thank you for updating us on this thread.

Do not hessite to contact us back in case any issues with the RadGrid control appear in feature. We will be glad to help you in case you roll back to the RadGrid control which I believe is a very powerful component with a  lot of great functionalities.

Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Aarsh
Top achievements
Rank 1
answered on 11 Dec 2012, 08:08 PM
Thank you so much Maria, I do have a radGrid question @ http://www.telerik.com/community/forums/aspnet-ajax/grid/nested-grid-demo-a-question.aspx#2410165.

[ AARSH :=) ]
0
Maria Ilieva
Telerik team
answered on 14 Dec 2012, 01:22 PM
Hi Irish,

Please review the answer provided in the forum post you mentioned and verify if it helps.
I would suggest you to continue the support communication in the newly created forum thread for better tracking the issue.

All the best,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Aarsh
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Aarsh
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or