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

RadGrid

5 Answers 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 25 Aug 2008, 02:44 PM
Hello everyone,

I have an issue with some of my IsDirty logic using the RadGrid control.  Basically we are inheriting the RadGrid control to create what is called RadGridView control in our pages.

Here is the logic to capture the grid data for an initial capture and for a current capture...

 
<P><FONT color=#2b91af size=2>RadGridView</FONT><FONT size=2rgv =   
(</FONT><FONT color=#2b91af size=2>RadGridView</FONT><FONT   
size=2>)childControl;</P> 
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2>   
saveCurrentPageIndex = rgv.CurrentPageIndex;</P> 
<P></P>  
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2> (</FONT><FONT   
color=#0000ff size=2>int</FONT><FONT size=2p = 0; p &lt; rgv.PageCount;   
p++)</P> 
<P>{</P> 
<P>rgv.CurrentPageIndex = p;</P> 
<P>rgv.Rebind();</P> 
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2> (</FONT><FONT   
color=#0000ff size=2>int</FONT><FONT size=2r = 0; r &lt; rgv.Items.Count;   
r++)</P> 
<P>{</P> 
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2> (</FONT><FONT   
color=#0000ff size=2>int</FONT><FONT size=2c = 0; c &lt;   
rgv.Items[r].Cells.Count; c++)</P> 
<P>{</P> 
<P>controlValues.Append(rgv.ClientID);</P> 
<P>controlValues.Append(</FONT><FONT color=#a31515 size=2>"_Pg"</FONT><FONT   
size=2> + p + </FONT><FONT color=#a31515 size=2>"Row"</FONT><FONT size=2> + r +   
</FONT><FONT color=#a31515 size=2>"Col"</FONT><FONT size=2> + c);</P> 
<P>controlValues.Append(</FONT><FONT color=#a31515 size=2>":"</FONT><FONT   
size=2>);</P> 
<P>controlValues.Append(rgv.Items[r].Cells[c].Text);</P> 
<P>controlValues.Append(</FONT><FONT color=#a31515 size=2>","</FONT><FONT   
size=2>);</P> 
<P>}</P> 
<P>}</P> 
<P>}</P> 
<P>rgv.CurrentPageIndex = saveCurrentPageIndex</FONT><FONT color=#008000   
size=2>//Reset page to saved page index.</P></FONT><FONT size=2>  
<P>rgv.Rebind();<BR></P></FONT> 

This is just part of the code to cycle through the data cells and create one big string of the control name and associated data. The format is a colon between control name and data. With a comma after each pair of control/data pair.  In the case of RadGrid the I added the page, row and col to the control name to identify each cell.

Ok, now the initial creatation of the string runs through this code with with no issues.  The grid is sorted in descending order and there is 11 items in the grid with paging on and page size to 10.  So I have 10 items in the first page and one in the second page. No problem.  The in my cancel button I do another capture and this time the same code is ran but now the page 0 has 10 items and then the page 1 has 10 items (same items).  It's like the move to page 2 (index 1) is not moving to the next page.

Why does this work on the initial creatation of the string but not the current creatation of the string.   What am I doing wrong???

TIA! JerryM

5 Answers, 1 is accepted

Sort by
0
Jerry
Top achievements
Rank 1
answered on 25 Aug 2008, 02:51 PM
Sorry, for the code formatting...  Here is the code in plain text format...

else if (childControl is RadGridView)

{

    RadGridView rgv = (RadGridView)childControl;

    int saveCurrentPageIndex = rgv.CurrentPageIndex;

    for (int p = 0; p < rgv.PageCount; p++)

    {

            rgv.CurrentPageIndex = p;

            rgv.Rebind();

            for (int r = 0; r < rgv.Items.Count; r++)

            {

                    for (int c = 0; c < rgv.Items[r].Cells.Count; c++)

                    {

                            controlValues.Append(rgv.ClientID);

                            controlValues.Append(

"_Pg" + p + "Row" + r + "Col" + c);

                            controlValues.Append(

":");

                            controlValues.Append(rgv.Items[r].Cells[c].Text);

                            controlValues.Append(

",");

                            }

                }

    }

    rgv.CurrentPageIndex = saveCurrentPageIndex;

//Reset page to saved page index.

    rgv.Rebind();

}

TIA! JerryM

0
Jerry
Top achievements
Rank 1
answered on 25 Aug 2008, 07:12 PM
Attn: Telerik Support,

I have an issue trying to move from page one to page two.  See initial post for text description of issue and see first reply for a readable code in text format.

Please let me know if you are looking at this issue.  I need to know asap if this can be worked around or if this is something I'm doing wrong.  based on my first pass throught this code I'd say the code works as one would expect. However, the 2nd pass does not move the page contents to the 2nd page (index 1).

Any help is greatly appreciated!!!  JerryM
0
Rosen
Telerik team
answered on 27 Aug 2008, 03:40 PM
Hi Jerry,

Unfortunately I'm not sure what may cause this behavior with the supplied details. Can you please send us small runnable project (attached to a formal ticket)? Thus we will be able to gather more details and be able to give you more to the point answer.

Kind regards,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rama
Top achievements
Rank 1
answered on 27 Aug 2008, 03:53 PM
Rosen, I have added another post for the same issue using rkunisetty@cfssc.org account. Post was yesterday.  I added more details to this post.

I will try to create a small web application project to duplicate this issue.  Right now the code is part of a large state web application project and I won't be able to provide that code.

As far you know this code should work as shown?

TIA! Jerry
0
Rosen
Telerik team
answered on 29 Aug 2008, 01:19 PM
Hi Rama,

We answered you question in this thread.

Best regards,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Jerry
Top achievements
Rank 1
Answers by
Jerry
Top achievements
Rank 1
Rosen
Telerik team
Rama
Top achievements
Rank 1
Share this question
or