I have Footer row in my Radgrid with Text box as footer item template control for few columns. User can enter a value in text box and then click button to save it in database. I am not getting textbox value at runtime in button click event, its always ""
I am using the below code to read access footer value.
13 Answers, 1 is accepted
Your code looks correct, please make sure you haven't set its visibility to false. Here is a sample code that i tried which works fine. Please provide your full code if this doesn't help.
Thanks for your reply.
I have not set the visibility to false and I'm able to access the textbox object but the value is always empty. See my design code below.
I was not able to replicate the issue, here is a sample code snippet , please try and see hows it different from your code.
I have tried your code, but if I type any text and check the text box text value in button click, I get "". Did you manage to get the text box value at run time with your code?
Yes i was able to get the value entered in the textbox using the previous code.
can u share the complete aspx and c# code?
You can download the full Sample code from the following link. Please run the sample solution and see if it is causing any issue at you end.
any one know this answer plz riply
i am added dynamic textboxes but i m unable to find that values and id of that control under button click event
can any one know plzz plzz riply
<telerik:RadGrid ID="gvEmployees_Edit" AutoGenerateColumns="true" OnItemCreated="gvEmployees_Edit_ItemCreated" runat="server" CellSpacing="0" CellPadding="0" HeaderStyle-Font-Bold="true"
GridLines="None" OnItemDataBound="gvEmployees_Edit_ItemDataBound" >
<GroupingSettings CaseSensitive="false" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="2" ScrollHeight="450px"/>
<MasterTableView AllowFilteringByColumn="false" FilterItemStyle-BackColor="#DCEDFD" DataKeyNames="UserID" >
<%--<telerik:GridBoundColumn DataField="UserID" Visible="False" UniqueName="UserID" HeaderText="UserID">
<%= Resources.Controls.Grid_EmptyRow %>
protected void gvEmployees_Edit_ItemDataBound(object sender, GridItemEventArgs e)
int I = 0;
if (e.Item.ItemType != null)
if (e.Item is GridDataItem)
GridDataItem item = (GridDataItem)e.Item;
if (column.UniqueName != "EmpID" && column.UniqueName != "Name" && column.UniqueName != "UserID")
TextBox tbEditBox = new TextBox();
tbEditBox.Text = item[column].Text.Replace(" ", "");
tbEditBox.Width = Unit.Pixel(40);
tbEditBox.ID = "txt" + I;
tbEditBox.MaxLength = 3;
tbEditBox.EnableViewState = false;
protected void btnSave_Click(object sender, EventArgs e)
foreach (GridDataItem row in gvEmployees_Edit.MasterTableView.Items)
Textbox txt=item.findcontrol("txt") as textbox;
When using .FindControl(), you must pass to it the same string that is passed to the ID property of the control when creating it. Perhaps you should consider generating the ID of the textbox by using the UniqueName of its column, so it is predictable and you can generate it again when accessing the textbox.
It is also important to note that you should create controls either in the markup, or with every postback (meaning, in Page_Init, or in the ItemCreated event).
I have two radgrids 1 and 2. Ragdrid1 has footer sum aggregate of column 'SID' and Radgrid2 has footer sum aggregate of 'LOADS'. I want to compare both footer values. Please suggest.
I got it.
If TypeOf e.Item Is GridFooterItem Then
Dim footer1 As GridFooterItem = CType(RadGrid1.MasterTableView.GetItems(GridItemType.Footer)(0), GridFooterItem)
Dim gstrSidTotal As String = footer1("QTY_EXP").Text
Dim footer2 As GridFooterItem = CType(RadGrid2.MasterTableView.GetItems(GridItemType.Footer)(0), GridFooterItem)
Dim gstrLoadTotal As String = footer2("TOTAL_QTY").Text
But now, is there a way to get only values. Here, the values i get are like 'SUM: 1200' or 'SUM: 800' or so on. Is there a way I could access only the values after ':'?
You can parse out the text from the cell contents. Since you know what the original aggregate is, you know the format that is set for the footer so you can string.Replace() it.
Alternatively, implement your own custom aggregation and you will be able to store actual results in an object in the page class. Here's how to implement your own aggregate functions: https://www.telerik.com/support/kb/aspnet-ajax/grid/details/how-to-create-custom-aggregate-functions.