Solved

asp.net

Posted on 2011-09-20
10
260 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
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
 

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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now