Hello,
my project work with dynamic column. If I add a GridBinaryImageColumn I can see it at the RadGrid. But if I start the Edit or the Insert I get an exception. In your documentation you insert javascript and _ItemCreated (…) function. I see a difference to add a GridBinaryImageColumn to designtime and to runtime
GridBinaryImageColumnEditor editor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor(“Upload”) as GridBinaryImageColumnEditor;
TableCell cell = (TableCell)editor.RadUploadControl.Parent; // add at rundtime = null
CustomValidator validator = new CustomValidator();
validator.ErrorMessage = "Please select file to be uploaded";
validator.ClientValidationFunction = "validateRadUpload";
validator.Display = ValidatorDisplay.Dynamic;
cell.Controls.Add(validator);
add function:
var gbic = new GridBinaryImageColumn();
gbic.HeaderText = row.ShowName;
gbic.ReadOnly = row.Edit; //true or false no difference
gbic.DataField = row.ColumnName; //Upload
gbic.UniqueName = row.ColumnName;
gbic.ImageAlign = ImageAlign.NotSet;
gbic.DataAlternateTextField = "Typ35";
gbic.DataAlternateTextFormatString = "Image of {0}";
dataGrid.MasterTableView.Columns.Add(gbic);
(Add another column type it works)
Thanks for your help
(I see the same problem with a GridBinaryImageColumn (add at designtime) if ReadOnly = true and I AddNewRecord)
OnClientClose
="clientClose" or other javascript including prototype if need
| function OK_Clicked() |
| { |
| var oWindow = GetRadWindow(); |
| //Get current content of text area |
| var oNewText = document.getElementById("myID").value; |
| var oNewText2 = document.getElementById("myID2").value; |
| oWindow.argument = oNewText + ";" + oNewText2; |
| oWindow.close(); |
| } |
| function clientClose(window) |
| { |
| //alert(window.argument); |
| if (window.argument != null) |
| { |
| //alert("OnClientClose:" + window.get_name() + " argument:" + window.argument); |
| var oArea = document.getElementById("myField1"); |
| var oArea2 = document.getElementById("myField2"); |
| //split argument ";" |
| var s=window.argument; |
| var val=s.split(";"); |
| oArea.value = val[0]; |
| oArea2.value= val[1]; |
| } |
| } |
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
| <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> |
| <!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" dir="rtl"> |
| <head runat="server"> |
| <title>Numeric Pager RTL Test</title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div dir="rtl"> |
| <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"/> |
| <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="5" Skin="Vista" AllowPaging="True" ShowGroupPanel="True" Width="100%"> |
| <PagerStyle AlwaysVisible="True" Mode="NumericPages" PageButtonCount="5" /> |
| <MasterTableView CommandItemDisplay="Top" Dir="RTL"/> |
| </telerik:RadGrid> |
| </div> |
| </form> |
| </body> |
| </html> |
| using System; |
| using System.Data; |
| using System.Globalization; |
| public partial class _Default : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar-SA"); |
| DataSet ds = new DataSet("NumericPagerDataSet"); |
| DataTable dt = new DataTable("GridTable"); |
| dt.Columns.Add("Id", System.Type.GetType("System.String")); |
| ds.Tables.Add(dt); |
| for (int i = 0; i < 10; i++) |
| { |
| DataRow dr = dt.NewRow(); |
| dr.SetField("Id", i.ToString()); |
| dt.Rows.Add(dr); |
| } |
| RadGrid1.DataSource = ds; |
| RadGrid1.DataBind(); |
| } |
| } |
