Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

asp.net

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
singsunn
Asked:
singsunn
1 Solution
 
BlueYonderCommented:
The gridview needs a databind.  Here is an example.
gridView.DataSource = theDataSource;
gridView.DataBind();
0
 
singsunnAuthor Commented:
I meant i am getting the new count, but when i assign that to the textbox it retains the old value.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
singsunnAuthor Commented:
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
 
binaryevoCommented:
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
 
singsunnAuthor Commented:
Yes, i do that, but the textbox.text doesn't show the new value.
0
 
disruptCommented:
can you provide an example on how you are doing so
0
 
singsunnAuthor Commented:
  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
 
disruptCommented:
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
 
singsunnAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now