Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
66 views
Hi,

I want the selected item image to be shown in my combo boxes and found this code snippet:
http://www.telerik.com/community/code-library/aspnet-ajax/combobox/show-the-selected-item-image-in-input.aspx

Unfortunately, it seems to work in IE but not Firefox. Any possible workarounds?

Regards,
JH
Kalina
Telerik team
 answered on 04 Jan 2011
1 answer
111 views
Hi all,

How can I spell check the ASP:textbox TextBoxcomments in this repeater? If I specify isClientID="true" it runs but says it can't find a valid HTML item. If I remove the isClientId I get a message saying it can't be Null. Thanks in advance, Dan

<asp:Repeater ID="repeaterApproveDept" Runat="server">
                    <ItemTemplate>
                        <TR>
                            <TD class="APR_ARIAL_10PT" width="100">
                                <%# FormatName((System.Data.DataRowView)Container.DataItem)%>
                            </TD>
                            <td valign="middle">
                            <cc1:myCCFDropDownList Enabled = "false" id="Myccfdropdownlist2" runat="server" Width="100" SetValue='<%# DataBinder.Eval(Container.DataItem, "RecommendedRating")%>' AutoPostBack="False" apAssessmentID='<%# DataBinder.Eval(Container.DataItem, "apAssessmentID")%>' siStaffID='<%# DataBinder.Eval(Container.DataItem, "siStaffID")%>' DeptAssignID='<%# DataBinder.Eval(Container.DataItem, "DeptAssignID")%>' IsLeadership='<%# DataBinder.Eval(Container.DataItem, "IsLeadership")%>' BogReviewerStatus='<%# DataBinder.Eval(Container.DataItem, "BogReviewerStatus")%>' DivStatus='<%# DataBinder.Eval(Container.DataItem, "DivStatus")%>'>
                                    <asp:ListItem Value="">Not Selected</asp:ListItem>
                                    <asp:ListItem Value="E">Exceeds</asp:ListItem>
                                    <asp:ListItem Value="A">Achieves</asp:ListItem>
                                    <asp:ListItem Value="I">Needs Improvement</asp:ListItem>
                                    <asp:ListItem Value="NR">NR</asp:ListItem>
                                    <asp:ListItem Value="RET">RET</asp:ListItem>
                                    <asp:ListItem Value="TNTR">TNTR</asp:ListItem>
                                    <asp:ListItem Value="WR">WR</asp:ListItem>
                                </cc1:myCCFDropDownList>
                            </td>
  
                            <TD width="85%" valign="middle">
                                <asp:textbox cssclass="APR_ARIAL_10PT" id="TextBoxComments" TextMode="MultiLine" runat="server" Rows= 5 Columns = 140 Text='<%# DataBinder.Eval(Container.DataItem, "Comments")%>'>
                                </asp:textbox>
                            </TD>
                            <td align="center">
                                <asp:CheckBox ID="CheckBoxCompleted" Runat="server" Checked='<%# DataBinder.Eval(Container.DataItem, "IsCompleted").ToString()=="1"%>' onclick="return false;">
                                </asp:CheckBox>
                            </td>
                        </TR>
                        <tr>
                            <td colspan="4"><hr>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
Dan
Top achievements
Rank 1
 answered on 04 Jan 2011
1 answer
80 views
Hi,

In Sharepoint aspx page i have dropdown and radcombobox controls.

When i try to fill radcombobox and asp:dropdownlist controls from the code behind file, only asp:dropdownlist is getting filled.
I am unable to fill radcombobox or any other rad controls in the codebehind file.

I double checked radcontrols id's in the aspx and in the code behind. There is no mismatch in the ID names.
Still only all my rad controls are null in the code behind. (asp.net controls i am able to access in the same code behind file)

Similar problem was found in one of the telerik forums  http://www.telerik.com/community/forums/aspnet-ajax/ajax/radlistbox-and-sharepoint-code-behind-project.aspx.

Pleass help me to resolve this issue.

//Code Behind File
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.Web.UI.WebControls;
using Microsoft.SharePoint.Utilities;
using Telerik.Web.UI;
  
namespace SPTelerikTest 
    public partial class SPTelerikTest : System.Web.UI.Page 
    
        protected DropDownList DropDownList1; 
        protected RadComboBox RadComboBox1; 
  
        protected void Page_Load(object sender, EventArgs e) 
        
  
           if (!Page.IsPostBack) 
            
               DropDownList1.Items.Add("Item1");
               RadComboBoxItem oradComboBoxItem = new RadComboBoxItem("Item1);
               RadComboBox1.Items.Add(oradComboBoxItem);
            }  
        
   }
}
 
 
 
//Aspx Page code snippet
 
<table>
        <tr>
            <td>
            <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="120px" Skin="WebBlue"   EmptyMessage="Select Partner Name" ></telerik:RadComboBox>
            </td>
            <td>
            <asp:DropDownList ID="DropDownList1" runat="server" Width="120px"  >
                                    </asp:DropDownList>
 
            </td>
      </tr>
</table>

Kalina
Telerik team
 answered on 04 Jan 2011
0 answers
204 views
Hi All,
Please assist, I'm testing Demo Client Edit with batch server update

After all when I browse, I got error, click on column for sorting, click on pageno. also got error.
And double click on row to edit doesn't work also.
Please advice ... Please see attached file fro your ref.
My code is as below ....
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="WebForm2.aspx.vb" Inherits="Jan2WebAppPrj.WebForm2" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
     <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
        </Scripts>
    </telerik:RadScriptManager>
       
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
        <!--
            //Custom js code section used to edit records, store changes and switch the visibility of column editors
 
            //global variables for edited cell and edited rows ids
            var editedCell;
            var arrayIndex = 0;
            var editedItemsIds = [];
 
            function RowCreated(sender, eventArgs) {
                var dataItem = eventArgs.get_gridDataItem();
 
                //traverse the cells in the created client row object and attach dblclick handler for each of them
                for (var i = 1; i < dataItem.get_element().cells.length; i++) {
                    var cell = dataItem.get_element().cells[i];
                    if (cell) {
                        $addHandler(cell, "dblclick", Function.createDelegate(cell, ShowColumnEditor));
                    }
                }
            }
 
            //detach the ondblclick handlers from the cells on row disposing
            function RowDestroying(sender, eventArgs) {
                if (eventArgs.get_id() === "") return;
                var row = eventArgs.get_gridDataItem().get_element();
                var cells = row.cells;
                for (var j = 0, len = cells.length; j < len; j++) {
                    var cell = cells[j];
                    if (cell) {
                        $clearHandlers(cell);
                    }
                }
            }
 
            function RowClick(sender, eventArgs) {
                if (editedCell) {
                    //if the click target is table cell or span and there is an edited cell, update the value in it
                    //skip update if clicking a span that happens to be a form decorator element (having a class that starts with "rfd")
                    if ((eventArgs.get_domEvent().target.tagName == "TD") ||
                        (eventArgs.get_domEvent().target.tagName == "SPAN" && !eventArgs.get_domEvent().target.className.startsWith("rfd"))) {
                        UpdateValues(sender);
                        editedCell = false;
                    }
                }
            }
            function ShowColumnEditor() {
                editedCell = this;
 
                //hide text and show column editor in the edited cell
                var cellText = this.getElementsByTagName("span")[0];
                cellText.style.display = "none";
 
                //display the span which wrapps the hidden checkbox editor
                if (this.getElementsByTagName("span")[1]) {
                    this.getElementsByTagName("span")[1].style.display = "";
                }
                var colEditor = this.getElementsByTagName("input")[0] || this.getElementsByTagName("select")[0];
                //if the column editor is a form decorated select dropdown, show it instead of the original
                if (colEditor.className == "rfdRealInput" && colEditor.tagName.toLowerCase() == "select") colEditor = Telerik.Web.UI.RadFormDecorator.getDecoratedElement(colEditor);
                colEditor.style.display = "";
                colEditor.focus();
            }
            function StoreEditedItemId(editCell) {
                //get edited row key value and add it to the array which holds them
                var gridRow = $find(editCell.parentNode.id);
                var rowKeyValue = gridRow.getDataKeyValue("ProductID");
                Array.add(editedItemsIds, rowKeyValue);
            }
            function HideEditor(editCell, editorType) {
                //get reference to the label in the edited cell
                var lbl = editCell.getElementsByTagName("span")[0];
 
                switch (editorType) {
                    case "textbox":
                        var txtBox = editCell.getElementsByTagName("input")[0];
                        if (lbl.innerHTML != txtBox.value) {
                            lbl.innerHTML = txtBox.value;
                            editCell.style.border = "1px dashed";
 
                            StoreEditedItemId(editCell);
                        }
                        txtBox.style.display = "none";
                        break;
                    case "checkbox":
                        var chkBox = editCell.getElementsByTagName("input")[0];
                        if (lbl.innerHTML.toLowerCase() != chkBox.checked.toString()) {
                            lbl.innerHTML = chkBox.checked;
                            editedCell.style.border = "1px dashed";
 
                            StoreEditedItemId(editCell);
                        }
                        chkBox.style.display = "none";
                        editCell.getElementsByTagName("span")[1].style.display = "none";
                        break;
                    case "dropdown":
                        var ddl = editCell.getElementsByTagName("select")[0];
                        var selectedValue = ddl.options[ddl.selectedIndex].value;
                        if (lbl.innerHTML != selectedValue) {
                            lbl.innerHTML = selectedValue;
                            editCell.style.border = "1px dashed";
 
                            StoreEditedItemId(editCell);
                        }
                        //if the form decorator was enabled, hide the decorated dropdown instead of the original.
                        if (ddl.className == "rfdRealInput") ddl = Telerik.Web.UI.RadFormDecorator.getDecoratedElement(ddl);
                        ddl.style.display = "none";
                    default:
                        break;
                }
                lbl.style.display = "inline";
            }
            function UpdateValues(grid) {
                //determine the name of the column to which the edited cell belongs
                var tHeadElement = grid.get_element().getElementsByTagName("thead")[0];
                var headerRow = tHeadElement.getElementsByTagName("tr")[0];
                var colName = grid.get_masterTableView().getColumnUniqueNameByCellIndex(headerRow, editedCell.cellIndex);
 
                //based on the column name, extract the value from the editor, update the text of the label and switch its visibility with that of the column
                //column. The update happens only when the column editor value is different than the non-editable value. We also set dashed border to indicate
                //that the value in the cell is changed. The logic is isolated in the HideEditor js method
                switch (colName) {
                    case "ProductName":
                        HideEditor(editedCell, "textbox");
                        break;
                    case "QuantityPerUnit":
                        HideEditor(editedCell, "textbox");
                        break;
                    case "UnitPrice":
                        HideEditor(editedCell, "textbox");
                        break;
                    case "UnitsInStock":
                        HideEditor(editedCell, "dropdown");
                        break;
                    case "UnitsOnOrder":
                        HideEditor(editedCell, "textbox");
                        break;
                    case "Discontinued":
                        HideEditor(editedCell, "checkbox");
                        break;
                    default:
                        break;
                }
            }
            function CancelChanges() {
                if (editedItemsIds.length > 0) {
                    $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest("");
                }
                else {
                    alert("No pending changes to be discarded");
                }
                editedItemsIds = [];
            }
            function ProcessChanges() {
                //extract edited rows ids and pass them as argument in the ajaxRequest method of the manager
                if (editedItemsIds.length > 0) {
                    var Ids = "";
                    for (var i = 0; i < editedItemsIds.length; i++) {
                        Ids = Ids + editedItemsIds[i] + ":";
                    }
                    $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest(Ids);
                }
                else {
                    alert("No pending changes to be processed");
                }
                editedItemsIds = [];
            }
            function RadGrid1_Command(sender, eventArgs) {
                //Note that this code has to be executed if you postback from external control instead from the grid (intercepting its onclientclick handler for this purpose),
                //otherwise the edited values will be lost or not propagated in the source
                if (editedItemsIds.length > 0) {
                    if (eventArgs.get_commandName() == "Sort" || eventArgs.get_commandName() == "Page" || eventArgs.get_commandName() == "Filter") {
                        if (confirm("Any unsaved edited values will be lost. Choose 'OK' to discard the changes before proceeding or 'Cancel' to abort the action and process them.")) {
                            editedItemsIds = [];
                        }
                        else {
                            //cancel the chosen action
                            eventArgs.set_cancel(true);
 
                            //process the changes
                            ProcessChanges();
                            editedItemsIds = [];
                        }
                    }
                }
            }
            window.onunload = function () {
                //this code should also be executed on postback from external control (which rebinds the grid) to process any unsaved data
                if (editedItemsIds.length > 0) {
                    if (confirm("Any unsaved edited values will be lost. Choose 'OK' to discard the changes before proceeding or 'Cancel' to abort the action and process them.")) {
                        editedItemsIds = [];
                    }
                    else {
                        //process the changes
                        ProcessChanges();
                        editedItemsIds = [];
                    }
                }
            };
     -->   
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="Default,Select,Textbox"
        EnableRoundedCorners="false" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadInputManager ID="RadInputManager1" EnableEmbeddedBaseStylesheet="false"
        Skin="" runat="server">
        <telerik:TextBoxSetting BehaviorID="StringBehavior" EmptyMessage="type here" />
        <telerik:NumericTextBoxSetting BehaviorID="CurrencyBehavior" EmptyMessage="type.."
            Type="Currency" Validation-IsRequired="true" MinValue="1" MaxValue="100000" />
        <telerik:NumericTextBoxSetting BehaviorID="NumberBehavior" EmptyMessage="type.."
            Type="Number" DecimalDigits="0" MinValue="0" MaxValue="100" />
    </telerik:RadInputManager>
 
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" Width="97%" ShowStatusBar="True" EnableEmbeddedScripts="false"
        AllowSorting="True" PageSize="15" GridLines="None" AllowPaging="True" runat="server"
        AutoGenerateColumns="False">
        <MasterTableView TableLayout="Fixed" DataKeyNames="ProductID" EditMode="InPlace"
            ClientDataKeyNames="ProductID" CommandItemDisplay="Bottom">
            <CommandItemTemplate>
                <div style="height: 30px; text-align: right;">
<asp:Image ID="imgCancelChanges" runat="server" ImageUrl="~/img/save.png"
AlternateText="Cancel changes" ToolTip="Cancel changes" Height="24px" Style="cursor: pointer;
margin: 2px 5px 0px 0px;" onclick="CancelChanges();" />
<asp:Image ID="imgProcessChanges" runat="server" ImageUrl="~/img/delete.jpg"
AlternateText="Process changes" ToolTip="Process changes" Height="24px" Style="cursor: pointer;
margin: 2px 5px 0px 0px;" onclick="ProcessChanges();" />
                </div>
            </CommandItemTemplate>
            <Columns>
                <telerik:GridBoundColumn UniqueName="ProductID" DataField="ProductID" HeaderText="ProductID"
                    ReadOnly="True" HeaderStyle-Width="5%" />
                <telerik:GridTemplateColumn UniqueName="ProductName" SortExpression="ProductName"
                    HeaderText="ProductName" HeaderStyle-Width="15%">
                    <ItemTemplate>
                        <asp:Label ID="lblProductName" runat="server" Text='<%# Eval("ProductName") %>' />
                        <asp:TextBox ID="txtBoxName" runat="server" Text='<%# Bind("ProductName") %>' Width="95%"
                            Style="display: none" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="QuantityPerUnit" HeaderText="QuantityPerUnit"
                    SortExpression="QuantityPerUnit" HeaderStyle-Width="10%">
                    <ItemTemplate>
                        <asp:Label ID="lblQuantityPerUnit" runat="server" Text='<%# Eval("QuantityPerUnit") %>' />
                        <asp:TextBox ID="txtQuantityPerUnit" runat="server" Text='<%# Bind("QuantityPerUnit") %>'
                            Width="95%" Style="display: none" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice"
                    HeaderStyle-Width="7%">
                    <ItemTemplate>
                        <asp:Label ID="lblUnitPrice" runat="server" Text='<%# Eval("UnitPrice", "{0:C}") %>' />
                        <asp:TextBox ID="txtUnitPrice" runat="server" Width="95%" Text='<%# Bind("UnitPrice") %>'
                            Style="display: none" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="UnitsInStock" HeaderText="UnitsInStock" SortExpression="UnitsInStock"
                    HeaderStyle-Width="8%">
                    <ItemTemplate>
                        <asp:Label ID="lblUnitsInStock" runat="server" Text='<%# Eval("UnitsInStock") %>' />
<asp:DropDownList ID="ddlUnitsInStock" runat="server" DataTextField="UnitsInStock"
DataValueField="UnitsInStock" DataSourceID="SqlDataSource2" SelectedValue='<%# Bind("UnitsInStock") %>'
                            Style="display: none" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="UnitsOnOrder" HeaderText="UnitsOnOrder" SortExpression="UnitsOnOrder"
                    HeaderStyle-Width="7%">
                    <ItemTemplate>
                        <asp:Label ID="lblUnitsOnOrder" runat="server" Text='<%# Eval("UnitsOnOrder") %>' />
                        <asp:TextBox ID="txtUnitsOnOrder" runat="server" Text='<%# Bind("UnitsOnOrder") %>'
                            Width="95%" Style="display: none" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued"
                    HeaderStyle-Width="6%">
                    <ItemTemplate>
                        <asp:Label ID="lblDiscontinued" runat="server" Text='<%# Eval("Discontinued") %>' />
                        <asp:CheckBox ID="chkBoxDiscontinued" runat="server" Checked='<%# Bind("Discontinued") %>'
                            Style="display: none" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnRowCreated="RowCreated" OnRowClick="RowClick" OnCommand="RadGrid1_Command"
                OnRowDestroying="RowDestroying" />
        </ClientSettings>
    </telerik:RadGrid>
 
    <br />
    <asp:Label ID="Label1" runat="server" EnableViewState="false" />
    <br />
    <br />
    <asp:SqlDataSource ID="SqlDataSource1"
         ConnectionString="<%$ ConnectionStrings:NorthWindsConnectionString %>" SelectCommand="SELECT * FROM [Products]"
        runat="server" UpdateCommand="UPDATE [Products] SET [ProductName] = @ProductName, [QuantityPerUnit] = @QuantityPerUnit, [UnitPrice] = @UnitPrice, [UnitsInStock] = @UnitsInStock, [UnitsOnOrder] = @UnitsOnOrder, [Discontinued] = @Discontinued WHERE [ProductID] = @ProductID">
         <UpdateParameters>
            <asp:Parameter Name="ProductID" Type="Int16" />
            <asp:Parameter Name="ProductName" Type="String" />
            <asp:Parameter Name="QuantityPerUnit" Type="String" />
            <asp:Parameter Name="UnitPrice" Type="Decimal" />
            <asp:Parameter Name="UnitsInStock" Type="Int16" />
            <asp:Parameter Name="UnitsOnOrder" Type="Int16" />
            <asp:Parameter Name="Discontinued" Type="Boolean" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
         ConnectionString="<%$ ConnectionStrings:NorthWindsConnectionString %>"
         SelectCommand="SELECT Distinct [UnitsInStock] FROM [Products]" />
    <!-- content end -->
     
    </asp:Content>
Imports System
Imports Telerik.Web.UI
Imports System.Collections
 
Public Class WebForm2
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
    End Sub
    Private Sub SetMessage(ByVal message As String)
        Label1.Text = String.Format("<span>{0}</span>", message)
    End Sub
    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemCreated
        If TypeOf e.Item Is GridDataItem Then
            Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
 
            Dim txtBox As TextBox = CType(dataItem.FindControl("txtBoxName"), TextBox)
            Dim stringSetting As TextBoxSetting = DirectCast(RadInputManager1.GetSettingByBehaviorID("StringBehavior"), TextBoxSetting)
            stringSetting.TargetControls.Add(New TargetInput(txtBox.UniqueID, True))
 
            txtBox = CType(dataItem.FindControl("txtQuantityPerUnit"), TextBox)
            stringSetting.TargetControls.Add(New TargetInput(txtBox.UniqueID, True))
 
            txtBox = CType(dataItem.FindControl("txtUnitPrice"), TextBox)
            Dim currencySetting As NumericTextBoxSetting = DirectCast(RadInputManager1.GetSettingByBehaviorID("CurrencyBehavior"), NumericTextBoxSetting)
            currencySetting.TargetControls.Add(New TargetInput(txtBox.UniqueID, True))
 
            txtBox = CType(dataItem.FindControl("txtUnitsOnOrder"), TextBox)
            Dim numericSetting As NumericTextBoxSetting = DirectCast(RadInputManager1.GetSettingByBehaviorID("NumberBehavior"), NumericTextBoxSetting)
            numericSetting.TargetControls.Add(New TargetInput(txtBox.UniqueID, True))
        End If
    End Sub
 
 
    Protected Sub UpdateValues(ByVal updatedItem As GridDataItem)
        Dim txtBox As TextBox = CType(updatedItem.FindControl("txtBoxName"), TextBox)
        SqlDataSource1.UpdateParameters("ProductName").DefaultValue = txtBox.Text
 
        txtBox = CType(updatedItem.FindControl("txtQuantityPerUnit"), TextBox)
        SqlDataSource1.UpdateParameters("QuantityPerUnit").DefaultValue = txtBox.Text
 
        txtBox = CType(updatedItem.FindControl("txtUnitPrice"), TextBox)
        SqlDataSource1.UpdateParameters("UnitPrice").DefaultValue = txtBox.Text
 
        txtBox = CType(updatedItem.FindControl("txtUnitsOnOrder"), TextBox)
        SqlDataSource1.UpdateParameters("UnitsOnOrder").DefaultValue = txtBox.Text
 
        Dim ddl As DropDownList = CType(updatedItem.FindControl("ddlUnitsInStock"), DropDownList)
        SqlDataSource1.UpdateParameters("UnitsInStock").DefaultValue = ddl.SelectedValue
 
        Dim chkBox As CheckBox = CType(updatedItem.FindControl("chkBoxDiscontinued"), CheckBox)
        SqlDataSource1.UpdateParameters("Discontinued").DefaultValue = chkBox.Checked
 
        SqlDataSource1.UpdateParameters("ProductID").DefaultValue = updatedItem.GetDataKeyValue("ProductID").ToString()
 
        Try
            SqlDataSource1.Update()
        Catch ex As Exception
            SetMessage(Server.HtmlEncode("Unable to update Products. Reason: " + ex.StackTrace).Replace("'", "'").Replace(vbCrLf, "<br />"))
        End Try
        SetMessage("Product with ID: " & updatedItem.GetDataKeyValue("ProductID") & " updated")
 
    End Sub
 
    Private Sub RadAjaxManager1_AjaxRequest1(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
        If e.Argument = String.Empty Then
            RadGrid1.Rebind()
        End If
        Dim editedItemIds As String() = e.Argument.Split(":")
        Dim i As Integer
        For i = 0 To editedItemIds.Length - 2
            Dim productId As String = editedItemIds(i)
            Dim updatedItem As GridDataItem = CType(RadGrid1.MasterTableView.FindItemByKeyValue("ProductID", Integer.Parse(productId)), GridDataItem)
 
            UpdateValues(updatedItem)
        Next
    End Sub
End Class

Thanks and best regards.

GoodNight ... Hope to see some suggestion tomorrow ... Thanks again.
Naunton
Top achievements
Rank 1
 asked on 04 Jan 2011
3 answers
256 views
Ok, I am using the radgrid to databind to a DataTable and it isn't updating any of the data when the edit form update button is pressed. From what I understand I need to rebind the data when the update button is pressed, however when I do that I am left with an empty grid.
Page load code:
 if (!IsPostBack)
   {
       
       DataTable dt = new DataTable();
       dt.Columns.Add("User");
       dt.Columns.Add("Comment");
       DataRow dr = dt.NewRow();
       dr["User"] = "Name";
       dr["Comment"] = "This is a comment";
       dt.Rows.Add(dr);
       Session.Add("dt", dt);
       RadGridComments.DataSource = dt;
       RadGridComments.DataBind();
   
   }
RadGrid:
<telerik:RadGrid ID="RadGridComments" runat="server" AllowFilteringByColumn="True" 
        AllowPaging="True" GridLines="None" EnableAjax="true" 
        AllowAutomaticUpdates="True" 
        oneditcommand="RadGridComments_EditCommand" 
        AutoGenerateEditColumn="True" >
        <MasterTableView AllowAutomaticUpdates="True">
        </MasterTableView>
</telerik:RadGrid>
and the edit command:
 protected void RadGridComments_EditCommand(object sender, GridCommandEventArgs e)
  {
      RadGridComments.DataSource = (DataTable)Session["dt"];
      RadGridComments.Rebind();
  }
now I want to specify that I am not able to use a SQL database with this project and I am having some problems making my datasource persistent.  I am going to be loading content from a website and filling out the radgrid, then when the edit command fires I need to push the info to the website(and then pull and rebind I assume).  I am unable to get my simple test code here working and I would appreciate your help.  So how do I set the new info from the edit form to my datatable? when using SQL databases it felt like this was done for me.
Pavlina
Telerik team
 answered on 04 Jan 2011
16 answers
155 views
When clicking on a button on toolbar its posting back twice code is:

<rad:RadToolbar ID="RadToolbarCustomer" style="position:absolute; left: 790px; top: 130px;" runat="server" skinspath="/XLogix/RadControls/ToolBar/Skins/" skin="XLogixBlue" AutoPostBack="true"

ImagesDir="/XLogix/RadControls/ToolBar/Skins/XLogixBlue/img/" OnOnClick="RadToolBar_OnClick">

<Items>

<rad:RadToolbarButton id="CreateButton" commandname="Create" DisplayType="TextImage" ButtonText="Create" ButtonImage="add_24.gif" tooltip="Create new order for this customer" width="90px" runat="server"/>

<rad:RadToolbarButton id="UpdateButton" commandname="Update" DisplayType="TextImage" ButtonText="Update" ButtonImage="add_24.gif" tooltip="Update order for this customer" width="90px" runat="server"/>

</Items>

</rad:RadToolbar>

this other toolbar on the same page does not have the same problem both using the same onclick event handler 
<
rad:RadToolbar ID="RadToolbarProduct" style="position:absolute; left: 570px; top: 620px;" runat="server" skinspath="/XLogix/RadControls/ToolBar/Skins/" skin="XLogixBlue" AutoPostBack="true"

ImagesDir="/XLogix/RadControls/ToolBar/Skins/XLogixBlue/img/" OnOnClick="RadToolBar_OnClick" Enabled="False" >

<Items>

<rad:RadToolbarButton id="DeleteBtn" commandname="Delete" DisplayType="TextImage" ButtonText="Delete" ButtonImage="remove_24.gif" tooltip="Delete item from order" width="90px" Enabled="False" Hidden="False" runat="server"/>

<rad:RadToolbarButton id="AddBtn" commandname="Add" DisplayType="TextImage" ButtonText="Add" ButtonImage="add_24.gif" tooltip="Add item to order" width="90px" Enabled="False" Hidden="False" runat="server"/>

<rad:RadToolbarButton id="NewBtn" commandname="New" DisplayType="TextImage" ButtonText="New" ButtonImage="add_24.gif" tooltip="Create item to add to order" width="90px" Enabled="False" Hidden="False" runat="server"/>

<rad:RadToolbarButton id="DoneBtn" commandname="Done" DisplayType="TextImage" ButtonText="Done" ButtonImage="add_24.gif" tooltip="Complete Order" width="90px" Enabled="False" Hidden="False" runat="server"/>

</Items>

</rad:RadToolbar>

This problem occurs if i have ajax on or off toolbar dll version is 1.6.5.0

Simon
Telerik team
 answered on 04 Jan 2011
2 answers
406 views
Hi, I am using "RadControls for ASP.NET AJAX Q3 2009" version and for RadGrid Item selection, I want to display cursor as pointer (hand),
I mean when user moves cursor over grid rows to select, it should show cursor as pointer so that user can know that they can select row.

How do I achieve this irrespective of applied skin? I am using Vista skin at present but I want to apply some code which should work even if I change skin.

Thanks in advance,
Nirav
Top achievements
Rank 1
 answered on 04 Jan 2011
2 answers
114 views
Hello,

It seems that RadGrid is using 'Datetime sql type'. (I mean it's lower year accepted is 1753.)
Is there a way to make it compatible with 'Datetime2 sql type' ?


Thank you.
Xrcr
Top achievements
Rank 1
 answered on 04 Jan 2011
3 answers
240 views
Hello,
        I have a RadAsyncUpload in my web page and it works well in internet explorer but it doesnt work in Google chrome. Please check the code below.

<telerik:RadAsyncUpload   id="radupload1" MaxFileInputsCount="1" AllowedFileExtensions=".pdf, .doc" MultipleFileSelection="Disabled"  MaxFileInputsCount="1"  MaxFileSize="12000000">

In google chrome, when I upload a file, it comes up with an exclamation mark and thats it. If I click on remove link, select file dialog opens up.
I tried without AllowedFileExtensions and MaxFileSize but still of no use. Is it something I m missing? Please let me know.


Thanks,
Bharani
Bharani Mani
Top achievements
Rank 1
 answered on 04 Jan 2011
1 answer
147 views

hi
Here im having the code.  i need to add a new template column such as combo box or check box inside the pop up and the option pop.. Please help me.


<%

@ Page Title="" Language="C#" MasterPageFile="~/Transactions/Calendar/CalendarMaster.Master"

 

 

AutoEventWireup="true" CodeBehind="Calendar.aspx.cs" Inherits="GemsStandard.Transactions.Calendar.Calendar" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<

 

asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

 

 

<style type="text/css">

 

 

.style1

 

{

 

width: 100%;

 

}

 

.example-panel

 

{

 

width: 870px;

 

 

height: 585px;

 

 

background: transparent url('Images/background.png') no-repeat 0 0;

 

 

padding: 55px 0 0 8px;

 

}

 

.RadSplitter

 

{

 

border: none !important;

 

 

margin: 0 !important;

 

}

 

.RadPanelBar .rootGroup

 

{

 

border-left: none;

 

 

border-right: none;

 

}

 

.calendar-container

 

{

 

width: 220px;

 

 

margin: 0 auto 7px auto;

 

}

 

.calendar-title

 

{

 

height: 26px;

 

 

padding: 6px 5px;

 

 

font-size: 16px;

 

 

font-color: #1e395b;

 

}

 

#RadScheduler1Panel

 

{

 

width: 100%;

 

 

overflow: hidden;

 

}

 

div.RadScheduler

 

{

 

width: 100%;

 

}

 

/* Styles for the appointment Subject */.RadScheduler .rsAptSubject

 

{

 

text-align: left;

 

 

margin: 0 0 3px;

 

 

font-size: 11px;

 

 

font-weight: bold;

 

 

color: #369;

 

 

height: 17px;

 

 

border-bottom: 1px solid #8bf;

 

 

width: 100%;

 

 

overflow: hidden;

 

}

 

/* Remove the Subject underline for all-day appointments */.RadScheduler .rsAllDayRow .rsAptSubject

 

{

 

border-bottom: none;

 

}

 

div.RadScheduler .rsCategoryPattern .rsAptContent, div.RadScheduler .rsCategoryPattern .rsAptIn, div.RadScheduler .rsCategoryPattern .rsAptMid

 

{

 

background: url('Images/pattern.png') repeat-x left top;

 

}

 

</style>

 

</

 

asp:Content>

 

<

 

asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

 

 

<table width="100%">

 

 

<tr>

 

 

<td>

 

 

<b>CALENDAR</b>

 

 

</td>

 

 

<td>

 

 

<asp:Label ID="lblAcademiYearID" runat="server" Visible="False"></asp:Label>

 

 

<asp:Label ID="lblInstitutionID" runat="server" Visible="False"></asp:Label>

 

 

</td>

 

 

<tr>

 

 

<td>

 

 

&nbsp;

 

 

</td>

 

 

<td>

 

 

<asp:Button ID="btnViewCalender" runat="server" Text="View Calendar" OnClick="btnViewCalender_Click" />

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<table class="style1">

 

 

<tr>

 

 

<td>

 

Holiday Type

 

<telerik:RadComboBox ID="radHolidayType" runat="server" EmptyMessage="Select Holiday Type"

 

 

Skin="Sunset">

 

 

</telerik:RadComboBox>

 

 

<telerik:RadCalendar ID="radCalendar1" runat="server" OnSelectionChanged="radCalendar1_SelectionChanged1"

 

 

OnDefaultViewChanged="radCalendar1_DefaultViewChanged" Skin="Sunset">

 

 

<dayoverstyle cssclass="rcHover"></dayoverstyle>

 

 

<fastnavigationstyle cssclass="RadCalendarMonthView RadCalendarMonthView_Sunset">

 

 

</fastnavigationstyle>

 

 

<disableddaystyle cssclass="rcDisabled"></disableddaystyle>

 

 

<weekenddaystyle cssclass="rcWeekend"></weekenddaystyle>

 

 

<viewselectorstyle cssclass="rcViewSel"></viewselectorstyle>

 

 

<selecteddaystyle cssclass="rcSelected"></selecteddaystyle>

 

 

<calendartablestyle cssclass="rcMainTable"></calendartablestyle>

 

 

<othermonthdaystyle cssclass="rcOtherMonth"></othermonthdaystyle>

 

 

<outofrangedaystyle cssclass="rcOutOfRange"></outofrangedaystyle>

 

 

</telerik:RadCalendar>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<telerik:RadCalendar ID="radCalendar2" runat="server" OnSelectionChanged="radCalendar2_SelectionChanged1"

 

 

Skin="Sunset">

 

 

<dayoverstyle cssclass="rcHover"></dayoverstyle>

 

 

<fastnavigationstyle cssclass="RadCalendarMonthView RadCalendarMonthView_Sunset">

 

 

</fastnavigationstyle>

 

 

<disableddaystyle cssclass="rcDisabled"></disableddaystyle>

 

 

<weekenddaystyle cssclass="rcWeekend"></weekenddaystyle>

 

 

<viewselectorstyle cssclass="rcViewSel"></viewselectorstyle>

 

 

<selecteddaystyle cssclass="rcSelected"></selecteddaystyle>

 

 

<calendartablestyle cssclass="rcMainTable"></calendartablestyle>

 

 

<othermonthdaystyle cssclass="rcOtherMonth"></othermonthdaystyle>

 

 

<outofrangedaystyle cssclass="rcOutOfRange"></outofrangedaystyle>

 

 

</telerik:RadCalendar>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</td>

 

 

<td>

 

 

<telerik:RadScheduler ID="radScheduler" runat="server" DataEndField="ToDate" DataKeyField="CalendarID"

 

 

DataSourceID="SqlDataSource1" DataStartField="FromDate" DataSubjectField="Subject"

 

 

Skin="Sunset" OnAppointmentCreated="radScheduler_AppointmentCreated1" OnAppointmentDataBound="radScheduler_AppointmentDataBound1"

 

 

OnAppointmentDelete="radScheduler_AppointmentDelete1" OnAppointmentInsert="radScheduler_AppointmentInsert1"

 

 

OnNavigationComplete="radScheduler_NavigationComplete1" OnAppointmentUpdate="radScheduler_AppointmentUpdate">

 

 

<advancedform modal="true" />

 

 

<resourcestyles>

 

 

<telerik:ResourceStyleMapping Type="Calendar" Text="Development" BorderColor="#B0CC9B" />

 

 

<telerik:ResourceStyleMapping Type="Calendar" Text="Marketing" />

 

 

<telerik:ResourceStyleMapping Type="Calendar" Text="Work" BackColor="#edd5b7" BorderColor="#cdb597" />

 

 

</resourcestyles>

 

<%

--<inlineinserttemplate>

 

<div>

<asp:LinkButton ID="LinkButton2" runat="server">LinkButton</asp:LinkButton>

</div>

</inlineinserttemplate>

<appointmenttemplate>

<div>

<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>

</div>

</appointmenttemplate>--

 

%>

 

 

</telerik:RadScheduler>

 

 

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EVISEAZY %>"

 

 

DeleteCommand="DELETE FROM [tblCalendar] WHERE [CalendarID] = @CalendarID" InsertCommand="INSERT INTO [tblCalendar] ([InstitutionID], [Subject], [FromDate], [ToDate], [HolidayTypeID], [AcdamicYearId]) VALUES (@InstitutionID, @Subject, @FromDate, @ToDate, @HolidayTypeID, @AcdamicYearId)"

 

 

SelectCommand="SELECT * FROM [tblCalendar]" UpdateCommand="UPDATE [tblCalendar] SET [InstitutionID] = @InstitutionID, [Subject] = @Subject, [FromDate] = @FromDate, [ToDate] = @ToDate, [HolidayTypeID] = @HolidayTypeID, [AcdamicYearId] = @AcdamicYearId WHERE [CalendarID] = @CalendarID">

 

 

<DeleteParameters>

 

 

<asp:Parameter Name="CalendarID" Type="Int64" />

 

 

</DeleteParameters>

 

 

<UpdateParameters>

 

 

<asp:Parameter Name="InstitutionID" Type="Int64" />

 

 

<asp:Parameter Name="Subject" Type="String" />

 

 

<asp:Parameter Name="FromDate" Type="DateTime" />

 

 

<asp:Parameter Name="ToDate" Type="DateTime" />

 

 

<asp:Parameter Name="HolidayTypeID" Type="Int64" />

 

 

<asp:Parameter Name="AcdamicYearId" Type="Int64" />

 

 

<asp:Parameter Name="CalendarID" Type="Int64" />

 

 

</UpdateParameters>

 

 

<InsertParameters>

 

 

<asp:Parameter Name="InstitutionID" Type="Int64" />

 

 

<asp:Parameter Name="Subject" Type="String" />

 

 

<asp:Parameter Name="FromDate" Type="DateTime" />

 

 

<asp:Parameter Name="ToDate" Type="DateTime" />

 

 

<asp:Parameter Name="HolidayTypeID" Type="Int64" />

 

 

<asp:Parameter Name="AcdamicYearId" Type="Int64" />

 

 

</InsertParameters>

 

 

</asp:SqlDataSource>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

<table>

 

 

<tr>

 

 

<td align="center">

 

 

</td>

 

 

</tr>

 

 

</tr>

 

 

</table>

 

</

 

asp:Content>

 

Peter
Telerik team
 answered on 04 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?