| protected void Grid_ExcelMLExportRowCreated ( object source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs e ) |
| { |
| if ( e.RowType == GridExportExcelMLRowType.HeaderRow ) |
| { |
| RowElement myNewRow = new RowElement(); |
| CellElement myNewCell = new CellElement(); |
| myNewCell.StyleValue = "myNewStyle"; |
| myNewCell.MergeAcross = e.Row.Cells.Count - 1; |
| //now call the hypothetical property which doesn't seem to exist... |
| myNewCell.WrapText = true; |
| //etc... |
| } |
| } |
setTimeout(function(){console.log($find("ctl00_MainContent_gv").get_batchEditingManager().get_currentlyEditedCell());},5000);<telerik:RadGrid> but it is
<telerik:GridTableView>
<ItemTemplate> <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %> <asp:Panel ID="ItemContainer" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>' runat="server"> <asp:Image runat="server" style="float:left" Width="200px" Height="200px" ImageUrl='<%# Eval("Url")%>' /> </asp:Panel> </ItemTemplate><body> <telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" /> <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" /> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <ajaxsettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl> </UpdatedControls> </telerik:AjaxSetting> </ajaxsettings> </telerik:RadAjaxManager> <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" Width="95%" AutoGenerateColumns="False" PageSize="7" AllowSorting="True" AllowPaging="True" GridLines="None" ShowStatusBar="true"> <mastertableview datasourceid="SqlDataSource1" datakeynames="Id" allowmulticolumnsorting="True" width="100%"> <Columns> <telerik:GridBoundColumn DataField="TT_TenMauVat" HeaderText="Tên mẫu vật" SortExpression="TenMauVat" FilterDelay="1000" HeaderStyle-Width="200px" UniqueName="TenMauVat" CurrentFilterFunction="Contains" ShowFilterIcon="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="TT_SoHieuMauVat" HeaderText="Số hiệu mẫu vật" SortExpression="SoHieuMauVat" FilterDelay="1000" HeaderStyle-Width="200px" UniqueName="SoHieuMauVat" CurrentFilterFunction="StartsWith" ShowFilterIcon="false"> </telerik:GridBoundColumn> </Columns> <DetailTables> <telerik:GridTableView AutoGenerateColumns="false" AllowSorting="false" DataSourceID="SqlDataSource2" Width="100%" ShowHeader="false" PageSize="7"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="Id" MasterKeyField="Id"></telerik:GridRelationFields> </ParentTableRelation> <Columns> <telerik:GridBoundColumn DataField="TT_TenMauVat" HeaderText="Tên mẫu vật" SortExpression="TenMauVat" FilterDelay="1000" HeaderStyle-Width="200px" UniqueName="TenMauVat" CurrentFilterFunction="Contains" ShowFilterIcon="false"> </telerik:GridBoundColumn> </Columns> <ItemTemplate> <fieldset style="padding: 10px;"> <legend style="padding: 5px;"><b>Thông tin chi ti?t c?a m?u v?t: <%#Eval("TT_TenMauVat")%></b> </legend> <table> <tbody> <tr> <td> <table> <tbody> <tr> <td> S? hi?u m?u v?t: </td> <td> <asp:Label ID="cityLabel" Text='<%#Bind("TT_SoHieuMauVat") %>' runat="server"></asp:Label> </td> </tr> <tr> <td> Tên m?u v?t: </td> <td> <asp:Label ID="Label2" Text='<%#Bind("TT_TenMauVat") %>' runat="server"></asp:Label> </td> </tr> <tr> <td> Noi luu tr? hi?n t?i: </td> <td> <asp:Label ID="Label3" Text='<%#Bind("TT_NoiLuuGiuHienTai") %>' runat="server"></asp:Label> </td> </tr> <tr> <td> Phuong th?c th?i di?m giao: </td> <td> <asp:Label ID="Label4" Text='<%#Bind("TT_PhuongThucThoiDiemGiao") %>' runat="server"></asp:Label> </td> </tr> <tr> <td> S? lu?ng: </td> <td> <asp:Label ID="Label5" Text='<%#Bind("TT_SoLuong") %>' runat="server"></asp:Label> </td> </tr> <tr> <td> S? hi?u b?o tàng: </td> <td> <asp:Label ID="Label6" Text='<%#Bind("TT_SoHieuBaoTang") %>' runat="server"></asp:Label> </td> </tr> <tr> <td> Ð? b?o m?t: </td> <td> <asp:Label ID="Label7" Text='<%#Bind("TT_DoBaoMat") %>' runat="server"></asp:Label> </td> </tr> </tbody> </table> </td> <td> <img width="200px" height="200px" src='<%#Eval("TT_HinhDaiDien")%>' alt="Hình d?i di?n" /> </td> </tr> </tbody> </table> </fieldset> </ItemTemplate> </telerik:GridTableView> <telerik:GridTableView AllowSorting="false" AutoGenerateColumns="false" ShowHeader="false" OnPreRender="RadGrid3_PreRender" DataSourceID="SqlDataSource3" Width="100%"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="Id" MasterKeyField="Id"></telerik:GridRelationFields> </ParentTableRelation> <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> <Columns> <telerik:GridImageColumn DataType="System.String" DataImageUrlFields="Url" Visible="false" AlternateText="Customer image" DataAlternateTextField="Url" ImageAlign="Middle" ImageHeight="110px" ImageWidth="90px" HeaderText="Image Column" FooterText="ImageColumn footer"> </telerik:GridImageColumn> </Columns> <ItemTemplate> <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %> <asp:Panel ID="ItemContainer" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>' runat="server"> <asp:Image runat="server" style="float:left" Width="200px" Height="200px" ImageUrl='<%# Eval("Url")%>' /> </asp:Panel> </ItemTemplate> </telerik:GridTableView> </DetailTables> </mastertableview> </telerik:RadGrid> <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:CoVatConnectionString %>" SelectCommand="SELECT * FROM [MauVat]" runat="server"></asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:CoVatConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [MauVat] where Id=@Id" runat="server"> <SelectParameters> <asp:Parameter Name="Id" Type="string"></asp:Parameter> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:CoVatConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [MauVatImage] where MauVatId=@Id " runat="server"> <SelectParameters> <asp:Parameter Name="Id" Type="string"></asp:Parameter> </SelectParameters> </asp:SqlDataSource></body>Everything was working but all of a sudden I am getting the following error on a radgrid in batch edit mode.
Unhandled exception at line 148, column 38 in http://aspnet-scripts.telerikstatic.com/ajaxz/2013.2.717/Grid/GridBatchEditingScripts.js
Public Sub Load_Component_NonGrid(ByVal iCompID As Int32, Init As Boolean)
If iCompID > 0 Then
With dgCompNonGrid
.Columns.Clear()
.DataSource =
Nothing
.DataSource = ippService.PlanDetails(iCompID)
.MasterTableView.DataKeyNames =
New String() {"ippComponentID", "ippComponentSeq"}
End With
End If
Dim boundColumn As GridBoundColumn
boundColumn =
New GridBoundColumn()
dgCompNonGrid.MasterTableView.Columns.Add(boundColumn)
With boundColumn
.DataField =
"ippComponentSrcValue"
.UniqueName =
"dgippComponentSrcValue"
.Display =
True
.HeaderText =
"Value"
.ItemStyle.Font.Size = 8
.HeaderStyle.Font.Bold =
True
.HeaderStyle.ForeColor =
Color.Black
.HeaderStyle.BackColor =
Color.White
.ReadOnly =
False
.ItemStyle.HorizontalAlign =
HorizontalAlign.Left
End With
boundColumn =
New GridBoundColumn()
dgCompNonGrid.MasterTableView.Columns.Add(boundColumn)
With boundColumn
.DataField =
"ippComponentBonusPct"
.UniqueName =
"dgippComponentBonusPct"
.Display =
True
.HeaderText =
"Bonus %"
.ItemStyle.Font.Size = 8
.HeaderStyle.Font.Bold =
True
.HeaderStyle.ForeColor =
Color.Black
.HeaderStyle.BackColor =
Color.White
.ReadOnly =
False
.ItemStyle.HorizontalAlign =
HorizontalAlign.Left
End With
Dim oDeleteColumn As New GridButtonColumn
dgCompNonGrid.MasterTableView.Columns.Add(oDeleteColumn)
With oDeleteColumn
.UniqueName =
"DeleteColumn"
.HeaderText =
"Remove"
.ItemStyle.Font.Size = 8
.HeaderStyle.Font.Bold =
True
.ButtonType =
GridButtonColumnType.ImageButton
.ImageUrl =
"~/Images/style7/cancel.gif"
.Display =
True
.CommandName =
"Delete"
.CommandArgument =
"Delete"
.ConfirmText =
"Delete this increment?"
.ConfirmDialogType =
GridConfirmDialogType.RadWindow
.ItemStyle.HorizontalAlign =
HorizontalAlign.Left
.HeaderStyle.Font.Bold =
True
.HeaderStyle.ForeColor =
Color.Black
.HeaderStyle.BackColor =
Color.White
End With
With dgCompNonGrid.MasterTableView
.CommandItemDisplay =
GridCommandItemDisplay.Bottom
.BatchEditingSettings.EditType =
GridBatchEditingType.Row
.CommandItemSettings.ShowRefreshButton =
False
End With
End Sub
If I set the <BatchEditingSettings EditType="Cell" /> then it works but when set to row I get the error above? Soon as I doubleClick on the row to edit. All the data loads just fine and even the Delete works. The Edit and Add New causes the error. Its like it is not putting the grid into EDIT mode when I BatchEditingSettings-OpenEditingEvent ="DblClick" ?
thanks.
aspx:
<telerik:GridTemplateColumn HeaderText="Image" UniqueName="image_file_location">
<ItemTemplate>
<asp:Image ID="ImgSign" Width="70" Height="80" runat="server" ImageUrl="test.png" />
</ItemTemplate>
</telerik:GridTemplateColumn>
c#:
protected void RadGrid_tab1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
DataRowView drv = (DataRowView)e.Item.DataItem;
GridDataItem item = (GridDataItem)e.Item;
Image img = (Image)item.Controls[0].FindControl("ImgSign");
string from=txt_test.Text;
string url = "test.png_"+from;
img.Attributes["onclick"] = "return ShowForm("+url+");";
}
}
Javascript:
<script type="text/javascript">
function ShowForm(url) {
alert(url);
window.radopen(url, "");
}
</script>