textbox = (
RadNumericTextBox)editItem["AmountPayorFC"].Controls[0];
textbox.NumberFormat.AllowRounding =
true;
textbox.NumberFormat.DecimalDigits = 0;
textbox.Style.Add(
"text-align", "right");
Hello there ..
I have been used a GridClientSelectColumn within a radgrid in order to take user selection
but my radgrid has multiple pages
when I chose items from first page and go to the second page I lose my items in my first page
how can I solve that . . . .
Hello, i am trying to perform drag and drop from tree view into a textbox control. However, i m having some issues. My treeview is databound to a sqldatasource if that makes a difference. can someone please take a look at my code...thanks
protected void RadTreeView1_NodeDrop(object sender, Telerik.Web.UI.RadTreeNodeDragDropEventArgs e)
{
if (TextBox1.ClientID == e.HtmlElementID)
{
TextBox1.Text = String.Empty;
foreach (RadTreeNode node in e.DraggedNodes)
{
{
//problem area!
TextBox1.Text = sender.ToString();
}
if (TextBox1.Text.Length > 0)
TextBox1.Text = TextBox1.Text.TrimEnd(new char[] { ',', ' ', '\n' });
}
}
Hi,
I am trying to have a grid where the detail item template is clickable/selectable as one with the columns relating to it.
If you take the demo http://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/rows/detailitemtemplate/defaultcs.aspx as an example, then I would like to click the row with the pictures and have the main row selected along with the detail item row. Effectively the row and detail item row should behave as one.
Can anyone please help?
Gary
I have a RadGrid in an update panel. I also have a RadWindowManager with several windows.
I have a column in the RadGrid that, when clicked, fires the ItemCommand event of the grid. In this event I generate a file from data in our database and send it to the browser:
byte[] s = System.Text.Encoding.ASCII.GetBytes(FileXML);
this.Response.ClearHeaders();
this.Response.Buffer = true;
this.Response.ContentType = "application/octet-stream";
this.Response.AddHeader("Content-Length", s.Length.ToString());
this.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + FileName + ".vlt\"");
this.Response.BinaryWrite(s);
Response.Flush();
Response.End();
This of course causes an error unless I register the RadGrid as a postback control in Page_Load:
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
scriptManager.RegisterPostBackControl(rgTemplates);
However, I have another column in this same grid that, when clicked, displays a RadWindow. The code-behind in the ItemCommand event is:
if (e.CommandName == "Upload")
{
HiddenField hdnTemplateUploadID = (HiddenField)e.Item.FindControl("hdnTemplateUploadID");
string UploadID = hdnTemplateUploadID.Value;
string script = "OpenTemplateReplace('" + UploadID + "');";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ShowUploadWin", script, true);
}
which calls the javascript function:
function OpenTemplateReplace(UploadID) {
var oManager = GetRadWindowManager();
$('[id*="hdnReplaceTemplateUploadID"]').val(UploadID);
radWin = oManager.GetWindowByName("rwReplaceTemplate");
radWin.setSize(500, 175);
radWin.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
radWin.show();
radWin.center();
return false;
}
When the RadGrid is registered as a postback control, this fails because the oManager ends up being undefined.
I also have a RadAsyncUpload control (in the same UpdatePanel as the RadGrid) and after I click the column and get the javascript error described above, the RadAsyncUpload control is no longer shown.
Is there some workaround or something to avoid having to register the RadGrid as a postback control and still be able to send a file via the Response? I'm trying to avoid actually creating the files and just having the column be a link to the file.
I have a grid which displays a field called "Import Type". There are various options under the Import Type based on a pre-defined enum model. One of the ImportType options is "Custom". If the user selects a Custom option, then another column next to it, "Mapping" needs to be enabled and mandatory. If the user selects any other ImportType, then "Mapping" needs to be blank and disabled. That is, if ImportType = "Custom" then Mapping is a mandatory cell for that particular row. If ImportType != "Custom" then Mapping should be disabled and blank. This ideally needs to be realtime during edit mode. So if the user clicks Edit and makes changes, this needs to be reflected instantly.
I'm struggling to get this working at all, mainly as I'm not sure what I'm doing it. Here is my code for the column so far.
columns.Bound(c => c.ImportType).Title(
"Import Type"
);
columns.Bound(c => c.Mapping).Title(
"Mapping"
)
.ClientTemplate(
"# if(ImportType== Models.CommonEnums.ImportType.Custom) #"
+
"# { return MappingId.HasValue === true} #"
+
"# else {MappingId = ''} #"
);
Should I be using a Client Template? I have tried a few other things, using just .Template, however this didn't do much for me either.
Could you point me in the right direction?
Hi,
Is it possible to show only the Month & Year popup and hide the days popup?
Thank you
Hello, I'm doing a system using UploadAsync and RadTilesList where images loaded the Upload will be generated in Tiles to be able to track which images the User uploaded, but I am facing a problem, I'm not managing to catch the Tiles after they are generated, the GetAllTiles is coming empty and visual images are there, another question is how to add the new images within the same group of Tiles? The following is a piece of code. Thank you
<telerik:RadTileList runat="server" ID="RadTileList1" Width="634px" TileRows="1" EnableDragAndDrop="true" CssClass="CustomSizeTiles"
ScrollingMode="Auto" AutoPostBack="false" RenderMode="Mobile" >
</telerik:RadTileList>
Private Sub GeraTileBtn_Click(sender As Object, e As System.EventArgs) Handles GeraTileBtn.Click
Dim Idx As Integer = 0
Dim Fator As Double
Dim Largura As Short
Dim Altura As Short
Dim g As System.Drawing.Image
Dim tileGroup As New TileGroup
'If RadTileList1.Groups.Count = 0 Then
RadTileList1.Groups.Add(tileGroup)
'End If
'ImageTile
Dim dirs As String() = Directory.GetFiles(Server.MapPath("~\" & Session("cache" & HiddenID.Value.ToString)) & "\Upload", "*.JPG")
Dim dir As String
For Each dir In dirs
g = System.Drawing.Image.FromFile(dir)
' Calcula o melhor fator
Fator = 100 / g.Height
Largura = Int(g.Width * Fator)
Altura = Int(g.Height * Fator)
If Largura > 100 Then
Fator = 100 / Largura
Largura = Int(Largura * Fator)
Altura = Int(Altura * Fator)
End If
g.GetThumbnailImage(Largura, Altura, Nothing, Nothing).Save(dir & "_Thumbs.JPG", System.Drawing.Imaging.ImageFormat.Jpeg)
'RadTileList1.Groups(0).Tiles
Dim ImageTile As New RadImageTile
ImageTile.ImageUrl = "~\cache\" & dir.Substring(Server.MapPath("").Length) & "_Thumbs.JPG"
'ImageTile.Title.Text = "Docpro"
ImageTile.Shape = TileShape.Square
tileGroup.Tiles.Add(ImageTile)
Idx += 1
Next
End Sub
Protected Sub CopiaImgBtn_Click(sender As Object, e As EventArgs) Handles CopiaImgBtn.Click
Count += 1
For Each Group As TileGroup In RadTileList1.Groups
For Each tile As RadBaseTile In Group.GetAllTiles()
'Code image imports
Next
Next
' For i = 0 To RadTileList1.Groups(0).Tiles.Count
' ImportaImagens(DirectCast(e.File.InputStream, System.IO.FileStream).Name, 0)
' Next
End Sub
I want to be able to intercept the insert action for a RadGrid and display a window allowing the user to select criteria which will then be carried over into the true editing control to pre-populate some of the data. I know that I can pre-populate controls in the ItemCommand event with hard-coded values by checking for InitInsertCommandName and locating the controls to populate.
Can I at this point open a radwindow containing the below and page. This window will allow the user to select from the 2 dropdowns & the textbox and on clicking the 'Select' button populate the grid with matching data from a database. On double clicking a row of data, that data will be sent back to the ItemCommand to populate the edit control.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ItemSelection.aspx.cs" Inherits="MaxOrdersTab.Dialogs.ItemSelection" %>
<!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
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
OnAjaxRequest
=
"RadAjaxManager1_AjaxRequest"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"gridLoadingPanel"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"gridLoadingPanel"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
div
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
AssociatedControlID
=
"ddlProviders"
>Product Provider: </
asp:Label
>
<
telerik:RadDropDownList
ID
=
"ddlProviders"
runat
=
"server"
Width
=
"200px"
CssClass
=
"DropDown_Providers"
>
</
telerik:RadDropDownList
>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
AssociatedControlID
=
"ddlGroups"
> Product Group: </
asp:Label
>
<
telerik:RadDropDownList
ID
=
"ddlGroups"
runat
=
"server"
>
</
telerik:RadDropDownList
>
<
asp:Label
ID
=
"Label3"
runat
=
"server"
AssociatedControlID
=
"tbxDescription"
> Product Description: </
asp:Label
>
<
telerik:RadTextBox
ID
=
"tbxDescription"
runat
=
"server"
>
</
telerik:RadTextBox
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Select"
onclick
=
"RadButton1_Click"
>
</
telerik:RadButton
>
<
br
/>
<
br
/>
<
telerik:RadAjaxLoadingPanel
ID
=
"gridLoadingPanel"
runat
=
"server"
Skin
=
"Default"
Width
=
"100%"
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnItemCreated
=
"RadGrid1_ItemCreated"
AllowPaging
=
"True"
Width
=
"99%"
AutoGenerateColumns
=
"False"
IsExporting
=
"False"
PageSize
=
"15"
ShowHeader
=
"False"
GroupPanelPosition
=
"Top"
>
<
MasterTableView
ClientDataKeyNames
=
"SelectionID"
Width
=
"100%"
CommandItemDisplay
=
"None"
PageSize
=
"5"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Product_Provider"
HeaderText
=
"Product Provider"
ReadOnly
=
"true"
SortExpression
=
"Product_Provider"
UniqueName
=
"Product_Provider"
AllowSorting
=
"False"
Exportable
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
FilterControlAltText
=
"Filter Product_Provider column"
>
<
HeaderStyle
Font-Bold
=
"True"
/>
<
ItemStyle
Width
=
"20%"
Wrap
=
"False"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Product_Group"
HeaderText
=
"Product Group"
ReadOnly
=
"true"
SortExpression
=
"Product_Group"
UniqueName
=
"Product_Group"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
FilterControlAltText
=
"Filter Product_Group column"
>
<
HeaderStyle
Font-Bold
=
"True"
/>
<
ItemStyle
Width
=
"20%"
Wrap
=
"False"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Product_Code"
HeaderText
=
"Product Code"
ReadOnly
=
"True"
SortExpression
=
"Product_Code"
UniqueName
=
"Product_Code"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
FilterControlAltText
=
"Filter Product_Code column"
>
<
HeaderStyle
Font-Bold
=
"True"
/>
<
ItemStyle
Width
=
"20%"
Wrap
=
"False"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Product_Description"
HeaderText
=
"Product Description"
ReadOnly
=
"true"
SortExpression
=
"Product_Description"
UniqueName
=
"Product_Description"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
>
<
HeaderStyle
Font-Bold
=
"True"
/>
<
ItemStyle
Width
=
"40%"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Unit_Sell"
HeaderText
=
"Unit Sell"
SortExpression
=
"Unit_Sell"
UniqueName
=
"Unit_Sell"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Unit_Cost"
HeaderText
=
"Unit Cost"
SortExpression
=
"Unit_Cost"
UniqueName
=
"Unit_Cost"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
GroupingSettings
CollapseAllTooltip
=
"Collapse all groups"
MainTableCaption
=
"Line Item Selection"
/>
<
ExportSettings
>
<
Pdf
AllowPrinting
=
"False"
>
</
Pdf
>
<
Csv
EncloseDataWithQuotes
=
"False"
/>
</
ExportSettings
>
<
ValidationSettings
EnableModelValidation
=
"False"
EnableValidation
=
"False"
/>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
></
Selecting
>
<
ClientEvents
OnRowDblClick
=
"RadGrid1_RowDblClick"
></
ClientEvents
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
</
telerik:RadAjaxLoadingPanel
>
</
div
>
</
form
>
</
body
>
</
html
>
protected
void
RadGrid1_ItemCommand(
object
source, Telerik.Web.UI.GridCommandEventArgs e)
{
GridEditableItem insertedItem;
String MyUserControlId;
UserControl MyUserControl;
switch
(e.CommandName)
{
case
RadGrid.InitInsertCommandName:
e.Canceled =
true
;
// display the RadWindow here to request the data to pre-populate the edit control.
e.Item.OwnerTableView.InsertItem();
insertedItem = e.Item.OwnerTableView.GetInsertItem();
MyUserControlId = GridEditFormItem.EditFormUserControlID;
MyUserControl = insertedItem.FindControl(MyUserControlId)
as
UserControl;
RadNumericTextBox box;
box = MyUserControl.FindControl(
"ntbUnitCost"
)
as
RadNumericTextBox;
box.Value =
// Value1 returned from selection dialog
box = MyUserControl.FindControl(
"ntbUnitSell"
)
as
RadNumericTextBox;
box.Value =
// Value2 returned from selection dialog
box = MyUserControl.FindControl(
"ntbQty"
)
as
RadNumericTextBox;
box.Focus();
break
;
default
:
break
;
}
}