<
script
type
=
"text/javascript"
>
var combox = $find("<%=dfDocuments.clientID %>");
combox.set_value('3');
</
script
>
Protected Sub dfDocuments_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles dfDocuments.DataBound
Dim li As New RadComboBoxItem
li.Value = "0"
li.Text = "--Select--"
li.Selected = False
dfDocuments.Items.Insert(0, li)
End Sub
Hi. I have a Radgrid with a MasterTableView and 2 Detail Tables (total of 3 levels). I have each GridTableView set to
HierarchyLoadMode
="Client" and I am binding the tables in my code-behind. I have an OnNeedDataSource method as well as an OnDetailTableDataBind method to do all the binding. On the first page load, the grids/tables all bind correctly. In the 3rd level detail table, I have a button that will call a server-side OnClick method that will remove that row from the data in the database. I then want to refresh the entire RadGrid to show that the row was removed, which may affect the upper 2 levels if it was the last row removed. So, at the end of the OnClick method in the code-behind, I try calling the Rebind() method on my RadGrid. Both the OnNeedDataSource and the OnDetailTableBind methods get fired and my screen seems to refresh (meaning it blinks and goes back to its original state of only the first level grid is expanded), however the data is not freshed and when I expand to the 3rd leve, the row I just deleted is still showing. When I refresh the browser, however, the data does refresh and the row is gone.
Even though the HierarchyLoadMode is set to Client, meaning that the data is kept in viewstate, I thought that by calling the Rebind method it would reload the data to viewstate and to the screen. Is that not correct? It seems to call the same methods when I refresh the browser page as when I call the .Rebind() method. What am I missing here?
By the way, I've got the Q3 2010 version of the RadControls and I'm using I.E. 6 (sad as it is) for my browser. I also have the ClientSettings for AllowExandCollapse = true (since the documentation I found said I should have that set when using HierarchyLoadMode of Client), however this doesn't seem to have any impact for my app.
Thanks for any help,
Shawna
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TaskExport.aspx.cs" Inherits="EncControl.TaskExport" %> |
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head id="Head1" runat="server"> |
<EncEventViewer:Title ID="ucTitle" runat="server" /> |
<link href="Styles.css" rel="stylesheet" type="text/css" /> |
</head> |
<body> |
<form id="frmMain" runat="server"> |
<telerik:RadScriptManager ID="radScriptMgr" runat="server"> |
</telerik:RadScriptManager> |
<script type="text/javascript" src="focus.js"></script> |
<telerik:RadFormDecorator ID="decoratorMain" runat="server" DecoratedControls="all" |
Skin="WebBlue"></telerik:RadFormDecorator> |
<table cellpadding="0" cellspacing="0" align="center" class="MainTable"> |
<EncEventViewer:Header ID="ucHeader" runat="server" /> |
<tr> |
<td class="MainMenu"> |
<EncEventViewer:Menu ID="ucMenu" runat="server" /> |
</td> |
<td class="MainWorkArea"> |
<!-- This is the main work area customized for each page --> |
<telerik:RadAjaxPanel ID="radAjaxPanel" runat="server"> |
<table cellpadding="2px" cellspacing="0" align="center" class="PageText"> |
<tr> |
<td> |
<br /> |
<asp:Label ID="lblPageHeader" runat="server" CssClass="ParagraphHeader" Text="Export Issue"></asp:Label><br /> |
<asp:Label ID="lblPageText" runat="server" CssClass="ParagraphBody" Text="This export may take a few minutes and will include the following components. You may remove any unwanted items from the Export."></asp:Label> |
</td> |
</tr> |
</table> |
<br /> |
<asp:Panel ID="pnlAddIssue" runat="server" Visible="true" DefaultButton="btnSave"> |
<table cellpadding="2px" cellspacing="0" align="center" class="FormTable"> |
<tr> |
<td class="FormHeader" colspan="2"> |
<asp:Label ID="lblFormHeader" runat="server" CssClass="FormHeaderLabel" Text="Export Issue"></asp:Label> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormPrimary" width="200px"> |
<asp:Label ID="Label1" runat="server" CssClass="ControlLabel" Text="Default Data: "></asp:Label> |
</td> |
<td align="left" class="FormPrimary" width="350px"> |
<asp:CheckBox ID="chkDefault" runat="server" Checked="true" Enabled="false" Text="Export Default Data" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormSecondary" width="200px"> |
<asp:Label ID="Label2" runat="server" CssClass="ControlLabel" Text="Next Steps:"></asp:Label> |
</td> |
<td align="left" class="FormSecondary" width="350px"> |
<asp:CheckBox ID="chkNextSteps" runat="server" Checked="true" Text="Export Next Steps" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormPrimary" width="200px"> |
<asp:Label ID="Label3" runat="server" CssClass="ControlLabel" Text="Resolutions:"></asp:Label> |
</td> |
<td align="left" class="FormPrimary" width="350px"> |
<asp:CheckBox ID="chkResolutions" runat="server" Checked="true" Text="Export Resolutions" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormSecondary" width="200px"> |
<asp:Label ID="Label4" runat="server" CssClass="ControlLabel" Text="Notes:"></asp:Label> |
</td> |
<td align="left" class="FormSecondary" width="350px"> |
<asp:CheckBox ID="chkExportNotes" runat="server" Checked="true" Text="Export Notes" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormPrimary" width="200px"> |
<asp:Label ID="lblAttachmentsLabel" runat="server" CssClass="ControlLabel" Text="Attachments:"></asp:Label> |
</td> |
<td align="left" class="FormPrimary" width="350px"> |
<asp:CheckBox ID="chkAttachments" runat="server" Checked="true" Text="Export Attachments" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormSecondary" width="200px"> |
<asp:Label ID="Label5" runat="server" CssClass="ControlLabel" Text="Notifications:"></asp:Label> |
</td> |
<td align="left" class="FormSecondary" width="350px"> |
<asp:CheckBox ID="chkNotifications" runat="server" Checked="true" Text="Export Email Notifications" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormPrimary" width="200px"> |
<asp:Label ID="Label6" runat="server" CssClass="ControlLabel" Text="Business Units:"></asp:Label> |
</td> |
<td align="left" class="FormPrimary" width="350px"> |
<asp:CheckBox ID="chkBusinessUnits" runat="server" Checked="true" Text="Export Associated Business Units" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormSecondary" width="200px"> |
<asp:Label ID="Label7" runat="server" CssClass="ControlLabel" Text="User Groups:"></asp:Label> |
</td> |
<td align="left" class="FormSecondary" width="350px"> |
<asp:CheckBox ID="chkUserGroups" runat="server" Checked="true" Text="Export Associated User Groups" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormPrimary" width="200px"> |
<asp:Label ID="Label8" runat="server" CssClass="ControlLabel" Text="Associated Issues:"></asp:Label> |
</td> |
<td align="left" class="FormPrimary" width="350px"> |
<asp:CheckBox ID="chkAssociatedIssues" runat="server" Checked="true" Text="Export Associated Issues" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormSecondary" width="200px"> |
<asp:Label ID="Label9" runat="server" CssClass="ControlLabel" Text="Events:"></asp:Label> |
</td> |
<td align="left" class="FormSecondary" width="350px"> |
<asp:CheckBox ID="chkEvents" runat="server" Checked="true" Text="Export Associated Events" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormPrimary" width="200px"> |
<asp:Label ID="Label10" runat="server" CssClass="ControlLabel" Text="Associated Tasks:"></asp:Label> |
</td> |
<td align="left" class="FormPrimary" width="350px"> |
<asp:CheckBox ID="chkRelatedTasks" runat="server" Checked="true" Text="Export Associated Tasks" /> |
</td> |
</tr> |
<tr> |
<td align="right" class="FormSecondary" width="200px"> |
<asp:Label ID="Label11" runat="server" CssClass="ControlLabel" Text="Issue History:"></asp:Label> |
</td> |
<td align="left" class="FormSecondary" width="350px"> |
<asp:CheckBox ID="chkIssueHistory" runat="server" Checked="true" Text="Export Issue History" /> |
</td> |
</tr> |
<tr> |
<td class="FormFooter" colspan="2" height="25px"> |
<asp:Button ID="btnExport" runat="server" Text="Export" CssClass="Control" OnClick="btnExport_Click" |
Width="125px" /> |
<asp:Button ID="btnCancel" runat="server" Text="<Back" CssClass="Control" OnClick="btnCancel_Click" |
CausesValidation="false" Width="125px" /> |
</td> |
</tr> |
</table> |
<table> |
<tr> |
<td> |
<telerik:RadEditor ID="TaskExportEditor" runat="server" SkinID="DefaultSetOfTools" |
OnExportContent="TaskExportEditor_ExportContent"> |
<ExportSettings OpenInNewWindow="true" /> |
</telerik:RadEditor> |
</td> |
</tr> |
</table> |
</asp:Panel> |
</telerik:RadAjaxPanel> |
<!-- This is the end of the main work area --> |
<br /> |
</td> |
</tr> |
<EncEventViewer:Footer ID="ucFooter" runat="server" /> |
</table> |
</form> |
</body> |
</html> |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Web; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using System.IO; |
using Telerik.Web.UI; |
namespace EncControl |
{ |
public partial class TaskExport : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
TaskExportEditor.Content = "Some content to export to a PDF"; |
} |
// the following line is generating a compile error |
protected void TaskExportEditor_ExportContent(object sender, Telerik.Web.UI.EditorExportingArgs e) |
{ |
TaskExportEditor.ExportSettings.FileName = "TaskExport"; |
string url = String.Format("~/{0}.pdf", TaskExportEditor.ExportSettings.FileName); |
string path = Server.MapPath(url); |
if (File.Exists(path)) |
{ |
File.Delete(path); |
} |
using (FileStream fs = File.Create(path)) |
{ |
Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput); |
fs.Write(info, 0, info.Length); |
} |
} |
protected void btnExport_Click(object sender, EventArgs e) |
{ |
TaskExportEditor.ExportToPdf(); |
} |
} |
} |
Hello,
I have ComboBox:
<telerik:RadComboBox ID="RadComboBox_Branze" runat="server" DataTextField="NAZWA_BRANZA" DataValueField="idTB_BRANZA" EnableLoadOnDemand="True" OnItemsRequested="RadComboBox_Branze_ItemsRequested" Width="300px" ><CollapseAnimation Duration="200" Type="OutQuint" /></telerik:RadComboBox>
In properties of RadComboBox I set:
DataTextField="businesslinename"
DataValueField="id_businessline"
where businesslinename is string value and id_businessline is int value, both retrieved from database
C# method to fill combo:
protected
void RadComboBox_Branze_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
if (e.Text.Length > 3)
{
RadComboBox combo = (RadComboBox)o;
combo.Items.Clear();
string sql = "select * from tb_branza where nazwa_branza like '%" + e.Text + "%' AND idTB_JEZYK=1";
//SqlDataSource1
SqlDataAdapter adapter = new SqlDataAdapter(sql, SqlDataSource1.ConnectionString.ToString());
DataTable data = new DataTable();
adapter.Fill(data);
try
{
int itemsPerRequest = 100;
int itemOffset = e.NumberOfItems;
int endOffset = itemOffset + itemsPerRequest;
if (endOffset > data.Rows.Count)
{
endOffset = data.Rows.Count;
}
if (endOffset == data.Rows.Count)
{
e.EndOfItems =
true;
}
else
{
e.EndOfItems =
false;
}
for (int i = itemOffset; i < endOffset; i++)
{
RadComboBox_Branze.Items.Add(
new RadComboBoxItem(data.Rows[i]["nazwa_branza"].ToString(), data.Rows[i]["nazwa_branza"].ToString()));
}
if (data.Rows.Count > 0)
{
e.Message =
String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString());
}
else
{
e.Message =
"No matches";
}
}
catch
{
e.Message =
"No matches";
}
}
}
I have got Button to submit method:
protected void btn_DodajBranze_Click(object sender, EventArgs e)
{
TextBox1.Text = RadComboBox_Branze.SelectedValue;
//DodajBranze(id_zamowienie_dns);
}
The problem is that I get DataTextField="businesslinename" instead DataValueField="id_businessline" into my TextBox1. How to retrieve a value from RadComboBox instead of text.
Best Regards
Dariusz Tomoń
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
[ArgumentOutOfRangeException: Height must be non negative. Parameter name: value] System.Web.UI.WebControls.Style.set_Height(Unit value) +8694900 System.Web.UI.WebControls.WebControl.set_Height(Unit value) +30 Telerik.Web.UI.AppointmentControl.CalculateSize() +234 Telerik.Web.UI.DayViewAppointmentControl.CalculateSize() +45 Telerik.Web.UI.Scheduler.Views.RowBuilder..ctor(IList`1 slotList, Int32 maxColumnWidth) +709 Telerik.Web.UI.Scheduler.Views.Week.RendererBase.CreateViewRows(IList`1 slotLists) +161 Telerik.Web.UI.Scheduler.Views.Week.RendererBase.CreateInnerContentTable(Control container, IList`1 slotLists) +101 Telerik.Web.UI.Scheduler.Views.Week.Renderer.GetInnerContent() +144 Telerik.Web.UI.Scheduler.Views.Week.Renderer.GetContent() +93 Telerik.Web.UI.RadScheduler.CreateContent() +122 Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +106 Telerik.Web.UI.RadScheduler.CreateChildControls() +10 System.Web.UI.Control.EnsureChildControls() +102 Telerik.Web.UI.RadScheduler.SaveViewState() +20 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +50 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148 System.Web.UI.Page.SaveAllState() +194 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2839 |