Hi All,
I have a radnumerictextbox within a grid. When this value is changed in edit mode, i want to perform some calculations.
I keep getting object reference not set to a instance on this line as well as the one after that.
famIncome = Convert.ToDouble(((RadNumericTextBox)dataItem.FindControl("rntxtAnnualIncome")).Value );
Not sure what i am missing here.
Let me know how to get those values.
protected void rntxtAnnualIncome_TextChanged(object sender, EventArgs e) { foreach (GridDataItem dataItem in rg_ProgramApp.EditItems ) { double famIncome; int famMembers; famIncome = Convert.ToDouble(((RadNumericTextBox)dataItem.FindControl("rntxtAnnualIncome")).Value ); famMembers = Convert.ToInt32(((RadNumericTextBox)dataItem.FindControl("rntxtFamilymembers")).Text); } }<telerik:GridTemplateColumn UniqueName="FamilyMembers" HeaderText="FamilyMembers"> <ItemTemplate> <asp:Label runat="server" ID="lblFamilyMembers" Text='<%# Bind("FamilyMembers") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <telerik:RadNumericTextBox runat="server" ID="rntxtFamilymembers" DbValue='<%# Bind("FamilyMembers") %>' MaxValue="20" NumberFormat-DecimalDigits="0" ></telerik:RadNumericTextBox> </EditItemTemplate> </telerik:GridTemplateColumn><telerik:GridTemplateColumn UniqueName="AnnualIncome" HeaderText="Annual Income"> <ItemTemplate> <asp:Label runat="server" ID="lblAnnualIncome" Text='<%# Bind("AnnualIncome") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <telerik:RadNumericTextBox runat="server" ID="rntxtAnnualIncome" Value='<%# Bind("AnnualIncome") %>' Type="Currency" NumberFormat-DecimalDigits="2" OnTextChanged="rntxtAnnualIncome_TextChanged" AutoPostBack="true" ></telerik:RadNumericTextBox> </EditItemTemplate> </telerik:GridTemplateColumn>
Thanks in Advance
I have a radgrid that uses Add New Record to enter data, then uses the server side validation to make sure that the User Id field is not duplicated in the database. When the server side validation fails, I display a message why the insert failed. To keep the insert mode, I use e.Canceled but values are lost.
I can't figure out how to keep the values in the textboxes after the server validation fails so the user won't have to retype everything.
Thanks in advance.
Hi,
I'm exporting my grid to Excel in Biff method.
I ssucessfully added background colors to the headers but I don't get to set borders on the cells of the excel export.
How can I achieve this ?

Hi
I want to show progressbar on radgrid while loading data, in need data source function data loading sql query contain brings a lot of data so i want to show progress of loading process instead of simply showing busy indicator with RadLaodingPanel. Is there any way we can do this ?
Regards,
Zain
I have a radGrid in which one column has some text in English language. Now I have implemented google translation on my website and I have changed the language of my website by google translation to other language.
But when I try to get that column data from code behind in selected language it won’t work, I get the text in English language.
How can I get the content in selected language in code behind?
Hello
Could You help me How can I get correct currentpageindex and Itemindex after filtering?
When I filter Grid column my Itemindex and currentpageindex Missed.
Thanks for your help
1. I am trying to add validate a textbox with Custom Validator in the Add New Record mode for a radgrid. The server validate method is called on Insert button click rather than lost focus for the textbox.
2. I want to keep the radgrid in insert mode if validation fails. e.Canceled = true keeps the grid in Insert mode but the user entered values are lost. How can I keep the user entered values in the insert mode if custom validation fails?
Thanks
I have an ObjectDataSource bound to my Grid, and the Automatic Updating works fine for all controls except for the RadComboBox in one of my columns as I'm not sure how to bind to it. In my ObjectDataSource, the values that are selected from the RadComboBox are stored in a List. In a regular ListView, I would just grab the selected values and put them in a List and assign them to e.NewValues() in the ListView's ItemUpdating event. I can't seem to figure out how to do something similar in the Grid's UpdateCommand event. Below is some abbreviated code to show what I'm trying to do. Appreciate any help you can offer.
Public Class MyCase Public Sub New() End Sub Private intId As Nullable(Of Integer) Public Property Id() As Nullable(Of Integer) Get Return intId End Get Set(ByVal value As Nullable(Of Integer)) intId = value End Set End Property Private strCaseName As String Public Property CaseName() As String Get Return strCaseName End Get Set(ByVal value As String) strCaseName = value End Set End Property Private objCodes As List(Of MyCode) = New List(Of MyCode) Public Property CodeList() As List(Of MyCode) Get Return objCodes End Get Set(ByVal value As List(Of MyCode)) objCodes = value End Set End PropertyEnd ClassPublic Class MyCode Public Sub New() End Sub Private intId As Nullable(Of Integer) Public Property Id() As Nullable(Of Integer) Get Return intId End Get Set(ByVal value As Nullable(Of Integer)) intId = value End Set End Property Private strName As String Public Property Name() As String Get Return strName End Get Set(ByVal value As String) strName = value End Set End PropertyEnd ClassProtected Sub gridCases_UpdateCommand(sender As Object, e As GridCommandEventArgs)End Sub
<telerik:RadGrid RenderMode="Lightweight" runat="server" ID="gridCases" AutoGenerateColumns="false" AllowPaging="true" DataSourceID="odsCases" AllowSorting="true" OnUpdateCommand="gridCases_UpdateCommand" AllowAutomaticUpdates="true"> <MasterTableView DataSourceID="odsCases" DataKeyNames="Id" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" EditMode="InPlace" CommandItemSettings-ShowRefreshButton="false"> <Columns> <telerik:GridBoundColumn DataField="Id" ReadOnly="true" ForceExtractValue="Always" Visible="false" /> <telerik:GridBoundColumn DataField="CaseName"></telerik:GridBoundColumn> <telerik:GridTemplateColumn HeaderText="Codes"> <ItemTemplate> <%#DataBinder.Eval(Container.DataItem, "Codes").ToString%> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox RenderMode="Lightweight" ID="ddlCodes" runat="server" CheckBoxes="true" DataSourceID="odsCodes" DataTextField="Name" DataValueField="Id"> </telerik:RadComboBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> </Columns> </MasterTableView> <PagerStyle Mode="NextPrevAndNumeric" /></telerik:RadGrid><asp:ObjectDataSource ID="odsCases" runat="server" TypeName="MyCaseManager" DataObjectTypeName="MyCase" SelectMethod="GetList" UpdateMethod="Save"></asp:ObjectDataSource><asp:ObjectDataSource ID="odsCodes" runat="server" DataObjectTypeName="MyCode" SelectMethod="GetCachedList" TypeName="MyCodeManager"></asp:ObjectDataSource>I have a RadGrid in Batch Edit mode with three drop down columns (I have tried this with both GridDropDownColumn and GridTemplateColumn containing a DropDownList control). The problem is that I need to populate each subsequent column based on what is selected in the previous one.
For example, if the first column has options A, B and C, and the user picks A, the second column is populated with D and E. If the user picks B, the second column is populated with F, G and H. And if the user picks A is the first column, and E in the second column, the third column is populated with I, J, K and L.
The datasource for the RadGrid is a List<class> structure where each row is an instance of the class. The class contains the selected value and options for the first dropdownlist. When the value of the first column is set in the class, the class setter for it updates the option values used in the second column and if the current second column value is no longer an option, sets it to the first entry in the second column options. Once the second column is set, the same thing happens for the third column's value and options. Therefore, each row could have different values for the second and third dropdownlists based on what is selected in the first dropdownlist of each row.
Can I do this in Batch Edit mode or do I have to do something like InPlace mode instead? I prefer the user experience in Batch Edit mode, but JavaScript is not my strong point. Using the pre-render event (either RadGrid's when I use GridDropDownColumns or the DropDownList control's when I use a template column), I can easily populate the first column with the right options, but I am having trouble populating and setting values in the subsequent columns.