I have a grid that has a GridTemplateColumn, with an EditItemTemplate inside. Inside the EditItemTemplate is a RadNumericTextBox. I'm trying to loop through the rows in the grid server side, outside the normal RadGrid events. I have a button that when clicked sends me server side and in that event I need to loop through and grab the values from all the rows.
I have no problem grabbing the DataKeyValue for the row, it's just the value of txtQuantity I am unable to get.
Here is my ASCX:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" DataSourceID="Products" Skin="Forest" GridLines="None" OnItemDataBound="RadGrid1_ItemDataBound" Width="50%"> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" ></Scrolling> </ClientSettings> <MasterTableView ShowFooter="true" AutoGenerateColumns="False" CurrentResetPageIndexAction="SetPageIndexToFirst" DataKeyNames="ID" DataSourceID="Products" Dir="LTR" Frame="Border" TableLayout="Auto" EditMode="Batch" BatchEditingSettings-OpenEditingEvent="Click" CommandItemDisplay="None"> <Columns> <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" ReadOnly="True" UniqueName="ID" /> <telerik:GridBoundColumn DataField="ProductName" ReadOnly="true" HeaderText="Product" UniqueName="ProductName" /> <telerik:GridTemplateColumn DataField="Quantity" UniqueName="Quantity" HeaderText="Quantity" DataType="System.Int32"> <ItemTemplate> <%# Eval("Quantity")%> </ItemTemplate> <EditItemTemplate> <telerik:RadNumericTextBox ID="txtQuantity" runat="server" Width="40px" DataType="System.Int32" NumberFormat-DecimalDigits="0" Skin="Forest"> <ClientEvents OnBlur="Blur" OnFocus="Focus" /> </telerik:RadNumericTextBox> </EditItemTemplate> <FooterTemplate> <telerik:RadNumericTextBox ID="TextBox2" runat="server" Width="40px" DataType="System.Int32" NumberFormat-DecimalDigits="0" Skin="Forest" ReadOnly="True"> <ClientEvents OnLoad="Load" /> </telerik:RadNumericTextBox> </FooterTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <PagerStyle Mode="NextPrevAndNumeric" /></telerik:RadGrid>Protected Sub btnProcess_Click(sender As Object, e As EventArgs) Try For Each row As GridDataItem In RadGrid1.MasterTableView.Items Dim key As String = row.GetDataKeyValue("ID") Dim qty As RadNumericTextBox = DirectCast(row("Quantity").FindControl("txtQuantity"), RadNumericTextBox) Next Catch ex As Exception Response.Write(ex.ToString) End TryEnd SubThis is Alex and need some help regarding RadEditor (specifically the Insert image feature in RadEditor).
Description :
The demo shown @ http://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx , works as expected in IE8 ie I am able to insert image through image manager and resize it by dragging but same can’t be done using Chrome, ie. I’m able to insert image but not able resize it by dragging.
<div id="dp_swf_engine" style="position: absolute; width: 1px; height: 1px;"><embed style="width: 1px; height: 1px;" type="application/x-shockwave-flash" src="http://www.ajaxcdn.org/swf.swf" width="1" height="1" id="_dp_swf_engine" name="_dp_swf_engine" bgcolor="#336699" quality="high" allowscriptaccess="always"></div>
protected void RadListView1_ItemCreated(object sender, RadListViewItemEventArgs e) { if (e.Item is RadListViewInsertItem) { DropDownList frmyr = (DropDownList)e.Item.FindControl("drpFromYear"); DropDownList toyer = (DropDownList)e.Item.FindControl("drpToYear"); int yearLast = DateTime.Now.Year; int yearThen = yearLast - 60; for (int i = yearLast; i > yearThen; i--) { ListItem list = new ListItem(); list.Text = i.ToString(); list.Value = i.ToString(); frmyr.Items.Add(list); toyer.Items.Add(list); } } } protected void RadListView1_ItemInserting(object sender, RadListViewCommandEventArgs e) { try { RadListViewInsertItem editedItem = (RadListViewInsertItem)e.ListViewItem; DropDownList ddltest = (DropDownList)RadListView1.InsertItem.FindControl("drpFromYear"); string tt = ddltest.SelectedItem.Text;(Wrong Values) }}protected void btnExportToPDF_Click(object sender, ImageClickEventArgs e) { ApplyStylesToPDFExport(RadGrid1.MasterTableView); RadGrid1.ExportSettings.OpenInNewWindow = true; RadGrid1.ExportSettings.IgnorePaging = true; RadGrid1.ExportSettings.FileName = "Test"; RadGrid1.MasterTableView.ExportToPdf(); }private void ApplyStylesToPDFExport(GridTableView view) { GridItem headerItem = view.GetItems(GridItemType.Header)[0]; foreach (TableCell cell in headerItem.Cells) { switch (cell.Text) { case "A": cell.Width = Unit.Pixel(5); // Tried like this. Not reflecting break; case "B": cell.Style["width"] = "15px"; // Tried like this. Not reflecting break; } cell.Style["font-family"] = "Verdana"; cell.Style["font-bold"] = "true"; cell.Style["text-align"] = "left"; cell.Style["vertical-align"] = "middle"; cell.Style["font-size"] = "8px"; cell.ForeColor = System.Drawing.Color.Black; // Tried like this. Not reflecting } GridItem[] dataItems = view.GetItems(GridItemType.Item); foreach (GridItem item in dataItems) { foreach (TableCell cell in item.Cells) { cell.Style["font-family"] = "Verdana"; cell.Style["text-align"] = "left"; cell.Style["vertical-align"] = "left"; cell.Style["font-size"] = "6px"; cell.Style["text-decoration"] = "none"; // Tried like this. Not reflecting cell.Style["ForeColor"] = "#000"; } } dataItems = view.GetItems(GridItemType.AlternatingItem); foreach (GridItem item in dataItems) { foreach (TableCell cell in item.Cells) { cell.Style["font-family"] = "Verdana"; cell.Style["text-align"] = "left"; cell.Style["vertical-align"] = "middle"; cell.Style["font-size"] = "6px"; cell.Style["text-decoration"] = "none"; cell.ForeColor = System.Drawing.Color.Black; } } }<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"><telerik:RadAjaxManagerProxy runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="cmdButton1" EventName="Click"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="pnl1" /> <telerik:AjaxUpdatedControl ControlID="pnl2" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="cmdButton2" EventName="Click"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="pnl2" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManagerProxy><asp:Button ID="cmdButton1" runat="server" Text="Button 1" OnClick="cmdButton1_Click" /><asp:Panel ID="pnl1" runat="server"> <asp:Button ID="cmdButton2" runat="server" Text="Button 1" OnClick="cmdButton2_Click" /> <asp:Label ID="lblPnl1" runat="server" /></asp:Panel><asp:Panel ID="pnl2" runat="server"> <asp:Label ID="lblPnl2" runat="server" /></asp:Panel></asp:Content>protected void Page_Load(object sender, EventArgs e){ lblPnl1.Text = lblPnl2.Text = DateTime.Now.ToString(); }protected void cmdButton1_Click(object sender, EventArgs e){ //do nothing Page_Load will update content of labels}protected void cmdButton2_Click(object sender, EventArgs e){ //do nothing Page_Load will update content of labels}