Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
204 views
I have a RadGrid with several GridDropDownColumns configured as well as several GridBoundColumns. The grid is bound to a data source programatically using the NeedDataSource event. The dropdown columns use RadComboBox style drop downs which are also bound to datasources programatically, in the grid's ItemDataBound event when the grid is in Edit mode. When the grid is not in Edit mode, I set the value of the dropdown column cell's Text property, also in the ItemDataBound event.

This all works are required. However if I do something that causes a postback, but does not rebind the grid when the grid is not in Edit mode - for example selecting a row in the grid - the values in the dropdown columns go blank. Is the TableCell.Text property not persisted through postback? If not, which property should I use for this purpose, or how can I populate it again, given that the ItemDataBound property does not fire which you simply select a row in the grid.

Code sample below:

<telerik:RadGrid runat="server" ID="grdControl" AllowFilteringByColumn="True" AllowPaging="True"
    AllowSorting="True" GridLines="None">
    <MasterTableView AutoGenerateColumns="False" EditMode="EditForms" DataKeyNames="ControlId, StepId"
        CommandItemDisplay="Bottom">
        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
        <Columns>
            <telerik:GridButtonColumn ButtonType="LinkButton" Text="Select" CommandName="Select" UniqueName="Select">
            </telerik:GridButtonColumn>
            <telerik:GridEditCommandColumn UniqueName="Edit">
            </telerik:GridEditCommandColumn>
            <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete">
            </telerik:GridButtonColumn>
            <telerik:GridDropDownColumn DataField="ControlName" HeaderText="Control Type" UniqueName="ControlName">
            </telerik:GridDropDownColumn>
            <telerik:GridBoundColumn DataField="MaxLength" HeaderText="Max Length" UniqueName="MaxLength">
            </telerik:GridBoundColumn>
            <telerik:GridDropDownColumn DataField="TextMode" HeaderText="Text Mode"
                UniqueName="TextMode" />
            <telerik:GridDropDownColumn DataField="ListSource" HeaderText="List Source" UniqueName="ListSource">
            </telerik:GridDropDownColumn>
            <telerik:GridBoundColumn DataField="EmptyListText" HeaderText="Empty List Text" UniqueName="EmptyListText">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <FilterMenu>
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
    </HeaderContextMenu>
</telerik:RadGrid>
 
 
 
        Private Sub grdControl_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdControl.ItemDataBound
            If TypeOf e.Item Is GridEditableItem Then
                Dim item As GridEditableItem = e.Item
                Dim control As FormControlInfo
                Dim ffc As New FlexFormController()
                If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
                    If e.Item.OwnerTableView.IsItemInserted Then
                        control = New FormControlInfo()
                    Else
                        control = e.Item.DataItem
                    End If
                    Dim editor As GridDropDownListColumnEditor
                    Dim cbo As RadComboBox
                    'ControlName dropdown
                    Dim path As String = Server.MapPath("~/DesktopModules/Dotcom.FlexForm/Components/FormControls/")
                    Dim files As String() = IO.Directory.GetFiles(path, "*.ascx")
                    For i = 0 To files.Length - 1
                        files(i) = IO.Path.GetFileName(files(i)).Replace(".ascx", String.Empty)
                    Next
                    editor = item.EditManager.GetColumnEditor("ControlName")
                    editor.DataSource = files
                    editor.DataBind()
                    editor.SelectedValue = control.ControlName
                    'ListSource dropdown
                    editor = item.EditManager.GetColumnEditor("ListSource")
                    Dim controller As New Lists.ListController()
                    Dim list As Lists.ListInfoCollection
                    If String.IsNullOrEmpty(control.ParentKey) Then
                        list = controller.GetListInfoCollection()
                        editor.DataTextField = "DisplayName"
                        editor.DataValueField = "Key"
                    Else
                        list = controller.GetListInfoCollection(Nothing, control.ParentKey.Replace(":", "."))
                        editor.DataTextField = "Name"
                        editor.DataValueField = "Name"
                    End If
                    editor.DataSource = list
                    editor.DataBind()
                    cbo = editor.ComboBoxControl
                    cbo.Items.Insert(0, New RadComboBoxItem(Localization.GetString("EmptyListItem", Definition.SharedResources), String.Empty))
                    If Not String.IsNullOrEmpty(control.ListSource) Then
                        editor.SelectedValue = control.ListSource
                    End If
                    'TextMode dropdown
                    editor = item.EditManager.GetColumnEditor("TextMode")
                    editor.DataSource = [Enum].GetNames(GetType(TextBoxMode))
                    editor.DataBind()
                    cbo = editor.ComboBoxControl
                    cbo.Items.Insert(0, New RadComboBoxItem(Localization.GetString("EmptyListItem", Definition.SharedResources), String.Empty))
 
                Else
                    control = e.Item.DataItem
                    item("ControlName").Text = control.ControlName
                    item("ListSource").Text = control.ListSource
                    item("EmptyListText").Text = Server.HtmlEncode(control.EmptyListText)
                    item("ParentControlId").Text = control.ParentId
                    If control.TextMode.HasValue Then
                        item("TextMode").Text = control.TextMode.Value.ToString
                    End If
                End If
            End If
        End Sub



Vikas
Top achievements
Rank 1
 answered on 03 Mar 2014
1 answer
67 views
Shot in the dark to see if you could provide more information regarding a custom button height issue I am seeing.  Using your Height40 example I ran in Visual Studio 2013 and got a bad display (see attached).  Ran the same page in VS2010 and it looks completely fine.  I'm attaching the project and screen shot for your review.  I have no idea what to do would appreciate any help you might have.
John

​<%@ Page %>

<%@ 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">
<head runat="server">
<title></title>
<style type="text/css">
/* IE7 line height */
* + html a.customHeight40 input.rbDecorated
{
line-height: 40px !important;
}
/* new sprite */
a.customHeight40, .customHeight40 input.rbDecorated
{
background-image: url(customHeight.gif) !important;
}
/* right rounded corner position */
a.customHeight40
{
background-position: right 0;
}
/* left rounded corner position */
a.customHeight40 input.rbDecorated
{
background-position: 0 -40px;
}
/* right rounded corner position hover state */
a.customHeight40:hover
{
background-position: right -80px;
}
/* left rounded corner position hover state */
a.customHeight40:hover input.rbDecorated
{
background-position: left -120px;
}
/* right rounded corner position active and focus states */
a.customHeight40:focus, a.customHeight40:active
{
background-position: right -160px;
}
/* left rounded corner position active and focus states */
a.customHeight40:focus input.rbDecorated, a.customHeight40:active input.rbDecorated
{
background-position: left -200px;
}
/* IE and Opera Focus and Active state fix with additional class, should be used !important */
a.customHeight40.rbPressedButton
{
background-position: right -160px !important;
}
a.customHeight40.rbPressedButton input.rbDecorated
{
background-position: left -200px !important;
}
/* IE8 Onclickg filckering Bug fix */
a.customHeight40.rbPressedIE8 input.rbDecorated, a.customHeight40.rbPressedIE8Rtl input.rbDecorated
{
-ms-background-position-x: 1px !important;
-ms-background-position-y: -199px !important;
}

a.customHeight40.rbPressedIE8Rtl input.rbDecorated
{
-ms-background-position-x: -1px !important;
}

/* fix end */
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<telerik:RadButton ID="RadButton3" runat="server" Text="Default Button Height 40px"
Height="40px" CssClass="customHeight40">
</telerik:RadButton>
<telerik:RadButton ID="RadButton2" runat="server" Text="Default Button Height 22px">
</telerik:RadButton>
</form>
</body>
</html>
Bozhidar
Telerik team
 answered on 03 Mar 2014
1 answer
152 views
In RadHtml Scatter Chart i'm using different symbols for the series(circle, triangle and square) and also different color for the symbols. I need to use the same symbol in the series to the legend also, for now it's just displaying square symbol with different color. Is this possible to display different symbol in the legend?
Niko
Telerik team
 answered on 03 Mar 2014
1 answer
78 views
I am using the demo radrotator xml live for this project to show rss news.
One of the items in the rss feed is <link> which I am not showing but I would like to use it with the _temClick to open the full article in a radWindow.
This is my actual code:
01.<telerik:RadRotator ID="RadRotator1" RotatorType="AutomaticAdvance" ScrollDirection="Up"
02.                  ScrollDuration="4000" runat="server" Width="714"
03.                  ItemWidth="695" Height="260px" ItemHeight="70" FrameDuration="1" InitialItemIndex="-1"
04.                  CssClass="rotator" OnItemClick="RadRotator1_ItemClick">
05.                  <ItemTemplate>
06.                      <div class="itemTemplate" style="background-image: url('IMAGES3/<%# this.GetDayOfWeek(XPath("pubDate").ToString()) %>.png');">
07.                          <div class="dateTime">
08.                              <div class="time">
09.                                  <%# (this.GetTimeOnly(XPath("pubDate").ToString())) %>
10.                              </div>
11.                              <div class="date">
12.                                  <%# (this.GetDateOnly(XPath("pubDate").ToString()))%>
13.                              </div>
14.                          </div>
15.                          <div class="title">
16.                              <span>
17.                                  <%# System.Web.HttpUtility.HtmlEncode(XPath("title").ToString())%>
18.                              </span>
19.                          </div>
20.                          <div class="buttonDiv">
21.                              <asp:Button ID="Button1" class="button" runat="server" Text="View" OnClientClick="OnClick"  />
22.                              <asp:HiddenField id="rssLink" runat="server" value='<%= System.Web.HttpUtility.HtmlEncode(XPath("link").ToString()%>' />
23.                               
24.                          </div>
25.                          <div class="description">
26.                              <span>
27.                                  <%# System.Web.HttpUtility.HtmlEncode(XPath("description").ToString())%>
28.                              </span>
29.                          </div>
30.                      </div>
31.                  </ItemTemplate>
32.              </telerik:RadRotator>
I tried with an hiddenfiled to get the value of <link> at row 22 but I cannot get that value in code behind. Then I understood I should use the _itemClick to get the value '<%= System.Web.HttpUtility.HtmlEncode(XPath("link").ToString()%>' but I am really battling to get it.
Please help. How ten I get the value of the rss item <link> of the clicked radRotator item in Radrotatr_itemClicked?
Felice
Top achievements
Rank 1
 answered on 03 Mar 2014
9 answers
90 views
Hello,

I'm having problems with RadButton inside a RadGrid in the latest Q3 2013 SP1 release. See attached image.
This wasn't a problem in the Q3 2013 release. Is this a known issue? Is there a workaround?

regards,
Ronnie (posted from Steinar's account)
Dan
Top achievements
Rank 2
 answered on 03 Mar 2014
12 answers
1.4K+ views
I'm using ASP.NET AJAX 2008.2.723. I am getting "unknown server tag" for every telerik control on the page (tabstrip & rotator). The controls are working in design mode, but when I build I get the server tag error. The register added to the page was

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

The BIN folder contains telerik.web.ui.dll (12,422kb), telerik.web.ui.dll.refresh (1kb), and telerik.web.ui.xml(2,909kb).

If the BIN files are there, and the Register is there, what else causes the telerik server tags to be unknown?

Richie
Top achievements
Rank 1
 answered on 03 Mar 2014
1 answer
91 views

Hi,
As i upload image or document, it is added before p tag

I want to set focus in paragraph tag so that image is inserted in p tag.

eg current scenario <img src=''/><p></p>
i want it like this <p><img src=""></p>

Thanks

Niko
Telerik team
 answered on 03 Mar 2014
3 answers
192 views
Hi,

Just installed the Q1’14 release and switched to the Office2010Black skin to see what it looks like, but now I don't see any expand/collapse images in the RadTreeView.

Aren't there supposed to be any?
Ivan Zhekov
Telerik team
 answered on 03 Mar 2014
4 answers
237 views
Hello Gurus,

I am giving Path Dynamically, i am getting the following exception:
 
 'C:/TestApplication.WebApp/UserWebDrive/acd8e7a9-1454-43d8-9679-272969ee317c/Images' is a physical path, but a virtual path was expected.

 here is the code i am using:
 -------------------------------------
 
 <telerik:RadFileExplorer runat="server" ID="FileExplorer1" Width="520px" Height="520px"
OnClientItemSelected="OnClientItemSelected" AllowPaging="true" PageSize="10">

   </telerik:RadFileExplorer>
 
 
            string Path = Server.MapPath("~/MagicWebDrive/" + UserID);
            string[] arrFiles = System.IO.Directory.GetDirectories(Path); 
            for (int i = 0; i < arrFiles.Length; i++)
            {
                FileExplorer1.Configuration.ViewPaths = arrFiles.ToArray();
                FileExplorer1.Configuration.DeletePaths = arrFiles.ToArray();
                FileExplorer1.Configuration.UploadPaths = arrFiles.ToArray();
            }

Thanks in Advance
Vessy
Telerik team
 answered on 03 Mar 2014
1 answer
181 views
Hello,

I recently made a change to a RadGrid by adding a Calculated column.  My data source is an in-memory dataset.  When I delete the final row in the grid and remove it from the dataset (in the code behind) I receive the following error:

Sys.WebForms.PageRequestManagerServerErrorException: Exception has been thrown by the target of an invocation.

I was able to get a little bit more information by adding a Rebind() to my grid in the deletion method.  I received the following inner exception
{"This row has been removed from a table and does not have any data.  BeginEdit() will allow creation of new data in this row."}

I have further proven the calculated field is the cause, by simply removing the GridCalculatedColumn and re-running the code with no issues.  The error return as soon as the calculated grid is added to the form.

Here's the markup:
<telerik:RadGrid ID="rdTicketGrid" runat="server" Width="70%" AllowAutomaticUpdates="false" AllowAutomaticDeletes="false" AllowAutomaticInserts="false" AllowSorting="false"
                            OnNeedDataSource="rdTicketGrid_NeedDataSource" AutoGenerateColumns="false" ShowFooter="true"
                            OnInsertCommand="rdTicketGrid_InsertCommand"
                            OnUpdateCommand="rdTicketGrid_UpdateCommand"
                            OnItemCreated="rdTicketGrid_ItemCreated"
                            OnDeleteCommand="rdTicketGrid_DeleteCommand"
                            OnItemDataBound="rdTicketGrid_ItemDataBound">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView DataKeyNames="TicketEntryID" CommandItemDisplay="Top" InsertItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="TicketEntryID" UniqueName="TicketEntryID" Display="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="NumOfTickets" HeaderText="Number of Tickets"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="NumberTicketsInSet" HeaderText="Number of Tickets per Set"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="PriceOfTickets" HeaderText="Price of Tickets" DataFormatString="{0:C}"></telerik:GridBoundColumn>
                    <telerik:GridCalculatedColumn HeaderText="Total Amount" UniqueName="TotalSetAmount" DataType="System.Double"  DataFormatString="{0:C}"
                                                    DataFields="NumOfTickets, NumberTicketsInSet, PriceOfTickets" Expression="{0}/{1}*{2}" FooterText="Total: " Aggregate="Sum"
                                                    FooterAggregateFormatString="{0:C}">
                    </telerik:GridCalculatedColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this ticket entry?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
                </Columns>
                <EditFormSettings>
                    <EditColumn ButtonType="ImageButton"></EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="rowDblClick" />
            </ClientSettings>
        </telerik:RadGrid>
 
        <telerik:RadInputManager runat="server" ID="rdInputMgr" Enabled="true">
            <telerik:NumericTextBoxSetting BehaviorID="TicketEntryIDTBSetting" Type="Number" AllowRounding="false" DecimalDigits="0"></telerik:NumericTextBoxSetting>
            <telerik:NumericTextBoxSetting BehaviorID="NumTicketsTBSetting" Type="Number" AllowRounding="false" DecimalDigits="0"></telerik:NumericTextBoxSetting>
            <telerik:NumericTextBoxSetting BehaviorID="PriceTicketsTBSetting" Type="Currency" AllowRounding="true" DecimalDigits="0"></telerik:NumericTextBoxSetting>
            <telerik:NumericTextBoxSetting BehaviorID="NumberTicketsInSetTBSetting" Type="Number" AllowRounding="true" DecimalDigits="0"></telerik:NumericTextBoxSetting>
        </telerik:RadInputManager>

And the code behind data source.  The dataset is built and then stored to session.  The data will be gathered later on submit.:

DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("TicketEntryID");
dt.Columns.Add("NumOfTickets", typeof(int));
dt.Columns.Add("NumberTicketsInSet", typeof(int));
dt.Columns.Add("PriceOfTickets", typeof(double));
 
ds.Tables.Add(dt);               
Session["ticketGridSrc"] = ds;.

Finally the offending method that brakes the grid:

protected void rdTicketGrid_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem editableItem = ((GridEditableItem)e.Item);
 
            try
            {
                int ticketEntryID = int.Parse(((GridDataItem)e.Item).GetDataKeyValue("TicketEntryID").ToString());
 
                //Access the data stored in the session
                DataSet currentDataSrc = ((DataSet)Session["ticketGridSrc"]);
 
                if (currentDataSrc != null)
                {
                    //build the select string we need to get the data from the table to delete
                    String selectStmt = string.Format("TicketEntryID = '{0}'", ticketEntryID);
 
                    //Get the row we are deleting from the source.              
                    DataRow[] updateRow = currentDataSrc.Tables[0].Select(selectStmt);
 
                    updateRow[0].Delete();
                    currentDataSrc.AcceptChanges();
                }
 
                Session["ticketGridSrc"] = currentDataSrc;
            }
            catch (Exception ex)
            {
                //TODO: Error Handling Here
            }
        }

Any help on determining why the error occurs would be greatly appreciated.

Thank you,
Konstantin Dikov
Telerik team
 answered on 03 Mar 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?