Solved

asp.net

Posted on 2011-09-20
10
291 Views
Last Modified: 2012-05-12
I have a Grid (telerik rad grid) in my aspx page along with a text box which displays the total number of grid items. I want to be able to update the text in the textbox every time grid refreshes, but the textbox value retains old value even if i assign a new value to the textbox when grid refreshes.
0
Comment
Question by:singsunn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 9

Expert Comment

by:BlueYonder
ID: 36568561
The gridview needs a databind.  Here is an example.
gridView.DataSource = theDataSource;
gridView.DataBind();
0
 

Author Comment

by:singsunn
ID: 36568591
I meant i am getting the new count, but when i assign that to the textbox it retains the old value.
0
 
LVL 16

Expert Comment

by:disrupt
ID: 36568834
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:singsunn
ID: 36569448
Thank you for the reply. I might have confused you, the text box is not in the Grid. It is a regular
asp:textbox i added to the page outside the Grid. However i want it to display the count in the grid below it.
0
 
LVL 14

Expert Comment

by:binaryevo
ID: 36569855
in the NeedDataSource event of the grid, you can get a count of your data that your bringing back each time and set your textbox.text value to the count of the data.
0
 

Author Comment

by:singsunn
ID: 36569904
Yes, i do that, but the textbox.text doesn't show the new value.
0
 
LVL 16

Expert Comment

by:disrupt
ID: 36570614
can you provide an example on how you are doing so
0
 

Author Comment

by:singsunn
ID: 36573634
  protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.AllowPaging = false;
        RadGrid1.Rebind();
        Textbox1.Text = RadGrid11.MasterTableView.Items.Count.ToString();
       RadGrid1.MasterTableView.AllowPaging = true;
        RadGrid1.Rebind();
    }
Textbox1.Text retains the old value.
0
 
LVL 16

Accepted Solution

by:
disrupt earned 500 total points
ID: 36573763
I would try a recursive find

http://sharpertutorials.com/recursive-findcontrol/

either that or loop through the radgrid like so:

foreach (GridDataItem item in MyRadGrid.MasterTableView.Items)
{
  TextBox txtBox = (TextBox)item.FindControl("Textbox1");
  txtBox.Text = RadGrid11.MasterTableView.Items.Count.ToString();
}
0
 

Author Comment

by:singsunn
ID: 36575205
once again, the text box is not in the grid. It is just something that displays the count of the items in the grid. the aspx page has
<asp:textbox/>
<telerik:radgrid>
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question