Hi,
I am creating columns programmatically based on the data return from database.
For example:
In Datatable i have following rows
ColumnHeader EditorType
ABC TextBox
XYZ DropDown
AAA TextBox
My Grid display format should be
ABC XYZ AAA
Textbox Editor Dropdown Editor Textbox Editor
But i have an error in rgDynamic.Rebind()
Note:
DataBinding of dropdown editor done in ItemCreated event.
protected void rgDynamic_PreRender(object sender, EventArgs e)
{
if (!rgDynamic.MasterTableView.IsItemInserted)
{
foreach (GridDataItem dataItem in rgDynamic.MasterTableView.Items)
{
if (dataItem is GridEditableItem)
{
dataItem.Edit = true;
}
}
}
if (rgDynamic.MasterTableView.Items.Count > 0)
rgDynamic.Rebind();
}
Stack Trace:
System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Telerik.Web.UI
StackTrace:
at Telerik.Web.UI.GridDropDownListColumnEditor.BindComboBox(Object sender, EventArgs e)
at System.Web.UI.Control.OnDataBinding(EventArgs e)
at Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e)
at Telerik.Web.UI.RadComboBox.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at Telerik.Web.UI.RadComboBox.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at Telerik.Web.UI.GridItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows)
at Telerik.Web.UI.GridItemBuilder.InitializeItem(Int32 dataSourceIndex, String& nextItemHierarchicalIndex, Boolean& itemIsInEditMode)
at Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group)
at Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls)
at Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource)
at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource)
at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at Telerik.Web.UI.GridTableView.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at Telerik.Web.UI.GridTableView.DataBind()
at Telerik.Web.UI.RadGrid.DataBind()
at Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason)
at Telerik.Web.UI.RadGrid.Rebind()
at WizardClient.rgDynamic_PreRender(Object sender, EventArgs e) in c:\------\release-40\WebMaster\Common\-----.aspx.cs:line 548
at System.Web.UI.Control.OnPreRender(EventArgs e)
at System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e)
at Telerik.Web.UI.RadCompositeDataBoundControl.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
<telerik:RadScriptBlock ID="scriptFilterEventDate" runat="server"> |
<script type="text/javascript"> |
function FromDateSelected(sender, args) { |
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); |
var ToPicker = $find('<%# ((GridItem)Container).FindControl("dateTo").ClientID %>'); |
var fromDate = FormatSelectedDate(sender); |
var toDate = FormatSelectedDate(ToPicker); |
if (toDate != '') { |
tableView.filter("EventDate", fromDate + " " + toDate, "Between"); |
} |
} |
function ToDateSelected(sender, args) { |
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); |
var FromPicker = $find('<%# ((GridItem)Container).FindControl("dateFrom").ClientID %>'); |
var fromDate = FormatSelectedDate(FromPicker); |
var toDate = FormatSelectedDate(sender); |
if (fromDate != '') { |
tableView.filter("EventDate", fromDate + " " + toDate, "Between"); |
} |
} |
function FormatSelectedDate(picker) { |
var date = picker.get_selectedDate(); |
var dateInput = picker.get_dateInput(); |
var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat()); |
return formattedDate; |
} |
</script> |
</telerik:RadScriptBlock> |
</FilterTemplate> |
function FormatSelectedDate(picker) { |
var date = picker.get_selectedDate(); |
var dateInput = picker.get_dateInput(); |
var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, "dd/MM/yyyy HH:mm:ss"); |
return formattedDate; |
} |
Hi,
I'm using RadAsyncUpload and when trying to upload a file with more than 206 characters in the filename I'm getting the HTTP error 414 URI too long.
Any idea how to fix this? If not, is there any way to replace the filename of the selected file to the first 140 characters to avoid this error?
Thanks
on month view the show more events link that goes to day view isn't showing for most days unless I think there is an all day event.
I added this tag but they still don't show
<MonthView VisibleAppointmentsPerDay="2" />
I have created a small sample that demonstrates a problem I am encountering in a much larger project.
The scenario is that I have a RadListView using LayoutTemplate/ItemTemplate and one of the controls in the ItemTemplate is a nested RadListView. Both lists use NeedDataSource for their data binding and the nested list needs the ID value of the parent list row in order to query for the correct data. So, in order to make the parent ID available to the child, I have a hiddenfield whose value is ',%# Eval("ID" %> and in the NeedDataSource of the child, I get the parent, do a FindControl on the hidden field and this gives me the ID I need. If I isolate this in a sample project, it works on initial load, but if I have a need to ReBind the parent list, when the child NeedDataSource executes, it can find the hidden field, but its value is not set.
Here is the full sample code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="dpCACJTest.ascx.cs"
Inherits="FACTS_WebApp.DataPanels.dpCACJTest" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
</telerik:RadAjaxManagerProxy>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
</telerik:RadAjaxLoadingPanel>
<telerik:RadListView ID="listParent" runat="server" OnNeedDataSource="listParent_NeedDataSource"
ItemPlaceholderID="ParentContainer" DataKeyNames="ID">
<LayoutTemplate>
<table width="210px">
<colgroup>
<col width="30px" />
<col width="170px" />
</colgroup>
<thead>
<tr>
<td >
<asp:Label ID="Label29" runat="server" Text="ID"></asp:Label>
</td>
<td >
<asp:Label ID="Label26" runat="server" Text="Values"></asp:Label>
</td>
</tr>
</thead>
<tbody>
<tr id="ParentContainer" runat="server">
</tr>
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="Label39" runat="server" Text='<%#Eval("ID") %>' ></asp:Label>
<asp:HiddenField ID="hfID" runat="server" Value='<%#Eval("ID") %>' />
</td>
<td id="cellValue" runat="server">
<telerik:RadListView ID="listChild" runat="server" OnNeedDataSource="listChild_NeedDataSource"
ItemPlaceholderID="ChildContainer">
<LayoutTemplate>
<table width="100%">
<asp:PlaceHolder ID="ChildContainer" runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="lblValue" runat="server" Text='<%#Eval("Value") %>' ></asp:Label>
</td>
</tr>
</ItemTemplate>
</telerik:RadListView>
</td>
</tr>
</ItemTemplate>
</telerik:RadListView>
<telerik:RadButton ID="btnRebind" runat="server" Text="Rebind" OnClick="btnRebind_Click">
</telerik:RadButton>
protected void listParent_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
{
StringBuilder sbSQL = new StringBuilder(1000);
DataTable dtList = new DataTable();
sbSQL.AppendFormat(@"SELECT 1 as ID
UNION
SELECT 2 as ID
UNION
SELECT 3 as ID");
dtList = DbHelper.GetDataTable(sbSQL.ToString(), null);
(sender as RadListView).DataSource = dtList;
}
protected void listChild_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
{
StringBuilder sbSQL = new StringBuilder(1000);
DataTable dtList = new DataTable();
string ID = "0";
RadListViewDataItem parentItem = (sender as RadListView).NamingContainer as RadListViewDataItem;
HiddenField hfID = (HiddenField)parentItem.FindControl("hfID");
if (hfID.Value != "")
ID = hfID.Value;
sbSQL.AppendFormat(@"SELECT '{0}' as ID, 'ID' + '{0}' + 'Value1' as Value
UNION
SELECT '{0}' as ID, 'ID' + '{0}' + 'Value2' as Value
", ID);
dtList = DbHelper.GetDataTable(sbSQL.ToString(), null);
(sender as RadListView).DataSource = dtList;
}
protected void btnRebind_Click(object sender, EventArgs e)
{
listParent.Rebind();
}
On initial load, the results display correctly:
ID Values
1 ID1Value1
ID1Value2
2 ID2Value1
ID2Value2
3 ID3Value1
ID3Value2
But, if I click the Rebind button and force listParent.ReBind();, then I get the following results:
ID Values
1 ID0Value1
ID0Value2
2 ID0Value1
ID0Value2
3 ID0Value1
ID0Value2
All the times the listChild_NeedsDataSource fires, the hiddenfield has no value so the string displayed is ID0 rather than ID1, ID2, and ID3.
Any idea on why the difference in behavior between initial load and ReBind()?
Thanks,
Jim
Chrome's latest update version 61 has created a bug in the display of the contextmenu of the radtreeview.
The scenario occurs when the treeview is the only element on the page and its content is bigger than the window it is in and the browser's native scrollbars are present. When scrolling down to items past the initial set in the viewport the context menu does not appear next to the node you click instead getting stuck at the bottom of the last node that can be seen without scrolling. In my app I have a treeview in a RadWindow but I found the same behavior with a treeview in a standard webform.
I've tested this in the demo example of contextmenu for treeview. The attached project is the same code as the demo and if you run it, expand all the nodes and make the browser window smaller than the treeview content so scrollbars appear, and right click the bottom nodes you will see the context menu not positioned by the node you clicked.
Any ideas for a workaround?
I need to change tooltip width. I found that one way to do it is the following:
.k-chart-tooltip
{
width:500px !important;
}
However, that will change tooltip sizes for all charts on the page. Ideally i would like to setup tooltip width from code behind.
Just in case i am providing here my tooltip setup.
Thank you
mySeries.TooltipsAppearance.ClientTemplate = "<div style=""font-size:16px;font-weight:900;"">" & dr("LocationName") & "</div><br/>" &
"<table>" &
"<tr><td><b>Value in 2015</b></td><td> " & SharedFunctions.fFormat(dr("BaseYearCurval")) & " ($M)<br/></td></tr>" &
"<tr><td><b>Value in " & TargetYear & "</b></td><td> " & SharedFunctions.fFormat(dr("SelectedYearCurval")) & " ($M)<br/></td></tr>" &
"<tr><td><b>" & IIf(direction = "import", "Imports", "Exports") & " to " & comparisonName & " (" & TargetYear & ")</b></td><td> " & SharedFunctions.fFormat(dr("SelectedYearCountryCurval")) & " ($M)<br/></td></tr>" &
"<tr><td><b>Percent Growth " & IIf(direction = "import", "Imports", "Exports") & " to " & comparisonName & " (2015-" & TargetYear & ")</b> </td><td> " & SharedFunctions.fFormat(dr("portpctgrowthcurval")) & "<br/></td></tr>" &
"<tr><td><b>Percent Ratio Growth in Share of " & IIf(direction = "import", "Imports", "Exports") & " to " & comparisonName & "</b> </td><td> " & SharedFunctions.fFormat(dr("portsharecountrycurval")) & "</td></tr>" &
"</table>"
Hi there guys,
i have this scenario where we have a lot of transactions on the grid that needs to be approved.The grid has a button bound to it for example...
<
telerik:GridButtonColumn
ButtonType
=
"LinkButton"
FilterControlAltText
=
"Filter column column"
Text
=
"Approve"
UniqueName
=
"btnApprove"
CommandName
=
"Delete"
>
<
HeaderStyle
Width
=
"50px"
/>
</
telerik:GridButtonColumn
>
The idea is to create and write each record to csv/excel spreadsheet per record once the approve button is clicked.
is this possible?
kind regards
Marc