Solved

asp.net

Posted on 2011-09-20
10
270 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to picture file 3 66
I need help displaying 2 models in one view in my MVC.Net application with C# code behind 5 30
asp.net mvc return json 2 52
SQL Login 17 37
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

10 Experts available now in Live!

Get 1:1 Help Now