Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
229 views
I have a pretty simple scenario using manual data operations with rad list view.  I insert an item into my collection in the ItemInserting event, the listview shows the new item but the insertitemtemplate is still showing.  Is my setup wrong?  Do I have to manually hide the thing?

Markup

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test2.aspx.vb" Inherits="Test2" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="rsm"></telerik:RadScriptManager>
    <div>
        <telerik:RadListView ID="rlv" runat="server" DataKeyNames="UserID" ItemPlaceholderID="itemPlaceholder" Height="400px" AllowPaging="true">
            <InsertItemTemplate>
                <tr>
                    <td>
                        <div style="vertical-align: middle; white-space: nowrap;">
                            <asp:LinkButton ID="btnInsert2" runat="server" Text="Insert" CommandName='<%# Telerik.Web.UI.RadListView.PerformInsertCommandName %>'></asp:LinkButton>
                            <asp:LinkButton ID="btnCancel2" runat="server" Text="Cancel" CommandName='<%# Telerik.Web.UI.RadListView.CancelCommandName %>'></asp:LinkButton>                           
                        </div>
                    </td>
                    <td>
                        <div style="vertical-align: middle; white-space: nowrap;">
                            <telerik:RadComboBox id="RadComboBox1" runat="server" autopostback="True" causesvalidation="False" allowcustomtext="True" backcolor="White" emptymessage="Select a Person" enableloadondemand="True" showmoreresultsbox="True" width="150px" dropdownwidth="200px" zindex="9002" enablescreenboundarydetection="False" style="margin-bottom: 0px" datatextfield="UserName" datavaluefield="pkUserID" filter="Contains" onitemsrequested="RCB_ItemsRequested">
                                        <CollapseAnimation Duration="200" Type="OutQuint" />
                                    </telerik:RadComboBox>
                        </div>
                    </td>
                </tr>
            </InsertItemTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <asp:Literal ID="lName" runat="server" Text='<%# Eval("UserName") %>'></asp:Literal>
                    </td>
                </tr>
            </ItemTemplate>
            <LayoutTemplate>
                <asp:LinkButton ID="btnInsert" runat="server" CausesValidation="False" CommandName='<%# Telerik.Web.UI.RadListView.InitInsertCommandName %>' Text="Add User" />
                <table>
                    <tr>
                        <td style="border: ridge 1px lightgray">
                            <strong>Applicable Users</strong>
                            <table>
                                <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
                            </table>
                        </td>
                    </tr>                   
                </table>
            </LayoutTemplate>
        </telerik:RadListView>
    </div>
    </form>
</body>
</html>

Code Behind

Partial Class Test2
    Inherits System.Web.UI.Page
 
    Public Property Users As IList(Of UserInfo)
        Get
            Return If(ViewState("Users"), New List(Of UserInfo))
        End Get
        Set(ByVal value As IList(Of UserInfo))
            ViewState("Users") = value
        End Set
    End Property
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Me.Users = GetInitialUsers()
        End If
 
        rlv.DataSource = Users
        rlv.DataBind()
 
        Me.ViewState.SetItemDirty("Users", True)
    End Sub
 
    Private Function GetInitialUsers() As IList(Of UserInfo)
        Dim Users As New List(Of UserInfo)
 
        Users.Add(New UserInfo(1, "1"))
        Users.Add(New UserInfo(2, "2"))
        Users.Add(New UserInfo(3, "2"))
        Users.Add(New UserInfo(4, "4"))
 
        Return Users
    End Function
 
    Protected Sub RCB_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
        Dim ComboBox As Telerik.Web.UI.RadComboBox = sender
 
        Dim itemOffset As Integer = e.NumberOfItems
        Dim NumberOfItems As Integer = 1000000000
        Dim Take As Integer = 20
 
        For i As Integer = 0 To Take
            ComboBox.Items.Add(New Telerik.Web.UI.RadComboBoxItem(i + itemOffset, (i + itemOffset).ToString))
        Next
 
        Dim NumberOfItemsInComboBox As Integer = e.NumberOfItems + ComboBox.Items.Count
 
        If NumberOfItems > 0 Then
            e.Message = [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", NumberOfItemsInComboBox, NumberOfItems)
        Else
            e.Message = "No matches"
        End If
 
        e.EndOfItems = (NumberOfItemsInComboBox >= NumberOfItems)
    End Sub
 
    Protected Sub rlv_ItemInserting(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadListViewCommandEventArgs) Handles rlv.ItemInserting
        Dim ComboBox As Telerik.Web.UI.RadComboBox = e.ListViewItem.FindControl("RadComboBox1")
 
        If Not String.IsNullOrWhiteSpace(ComboBox.SelectedValue) Then
            Dim UserID As Integer = ComboBox.SelectedValue
            Dim UserName As String = ComboBox.Text
 
            Me.Users.Add(New UserInfo(UserID, UserName))
        Else
            e.Canceled = True
        End If
 
    End Sub
 
    <Serializable()>
    Public Class UserInfo
        Private _UserID As Integer
        Private _UserName As String
 
        Public ReadOnly Property UserID As Integer
            Get
                Return _UserID
            End Get
        End Property
 
        Public ReadOnly Property UserName As String
            Get
                Return _UserName
            End Get
        End Property
 
        Public Sub New(ByVal UserID As Integer, ByVal UserName As String)
            _UserID = UserID
            _UserName = UserName
        End Sub
 
    End Class
 
End Class

I attached a couple of screen shots to illustrate my problem as well
Princy
Top achievements
Rank 2
 answered on 25 Feb 2011
1 answer
432 views
Hi, I've got 5 linkbuttons that I'm using as a visual replacement for radio buttons.  I want them to expand to the width of their container, but when I lay them out in a table, they overlap due to some issue with the CSS, I assume.  Could someone help me fix the CSS so they do not overlap?  Here is my code:

<div class="box" id="ReductionsBox" runat="Server">
    <div class="boxheader">Reductions</div>
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td><telerik:RadButton ID="NoReductionButton" Text="No Reduction" Checked="True" AutoPostBack="false" Skin="Windows7" ButtonType="LinkButton" GroupName="ReductionType" ToggleType="Radio" Width="100%" runat="server" /></td>
            <td><telerik:RadButton ID="PartialWriteOffButton" Text="Reduce Payoff (Write-Off)" AutoPostBack="false" Skin="Windows7" ButtonType="LinkButton" GroupName="ReductionType" ToggleType="Radio" Width="100%" runat="server" /></td>
            <td><telerik:RadButton ID="PartialWaiveButton" Text="Reduce Payoff (Waive)" AutoPostBack="false" Skin="Windows7" ButtonType="LinkButton" GroupName="ReductionType" ToggleType="Radio" Width="100%" runat="server" /></td>
            <td><telerik:RadButton ID="FullWriteOffButton" Text="Close Case (Write-Off)" AutoPostBack="false" Skin="Windows7" ButtonType="LinkButton" GroupName="ReductionType" ToggleType="Radio" Width="100%" runat="server" /></td>
            <td><telerik:RadButton ID="FullWaiveButton" Text="Close Case (Waive)" AutoPostBack="false" Skin="Windows7" ButtonType="LinkButton" GroupName="ReductionType" ToggleType="Radio" Width="100%" runat="server" /></td>
        </tr>
    </table>
</div>

Attached is a screenshot.
Bozhidar
Telerik team
 answered on 25 Feb 2011
1 answer
198 views
Hi Team,
               I'm using Rad Grid in my application. I need to show my grid as follows. 

Source Column

Lookup Column

Filter Condition

Action

This is Drop down (Dynamic values)

This is Dropdown  (Dynamic values)

This is (static values) Drop down

Edit

This is Dropdown (Dynamic values)

This is Dropdown  (Dynamic values)

This is (static values) Drop down

Edit

This is Drop down (Dynamic values)

This is Dropdown  (Dynamic values)

This is (static values) Drop down

Edit

This is Dropdown (Dynamic values)

This is Dropdown  (Dynamic values)

This is (static values) Drop down

Edit


Each Dynamic Dropdown has different set of values.
aspx coding:

<telerik:RadGrid runat="server" ID="GridRelateColumn" GridLines="None" Skin="Outlook"

AllowPaging="true" PageSize="10" OnItemDataBound="GridRelateColumn_ItemDataBound"

AutoGenerateColumns="False">

<mastertableview>

<Columns>                                                                                         

      <telerik:GridTemplateColumn headertext="Source Columns" uniquename="SourceColumn">

           <itemtemplate>                                                                                                 

<asp:DropDownList ID="SourceDropDownList" runat="server” Width="160px"></asp:DropDownList>

</itemtemplate>

                                                                                        </telerik:GridTemplateColumn>                                                                                        <telerik:GridTemplateColumn headertext="LookUp Columns" uniquename="LookUpColumns">

<itemtemplate>                                                                                                          <asp:DropDownList ID="LookUpDropDownList" Width ="160px"  runat="server"></asp:DropDownList>

</itemtemplate>

</telerik:GridTemplateColumn>

     <telerik:GridTemplateColumn UniqueName="FilterCondition" HeaderText="Filter Condition">

<itemtemplate>                                                                                                 <asp:DropDownList runat="server" Width ="160px" ID="ddlApplicationStatus"></asp:DropDownList>

</itemtemplate>                                                                                        </telerik:GridTemplateColumn>                                                                                        <telerik:GridEditCommandColumn HeaderText="Action" UniqueName="EditCommandColumn" />

</Columns>

</mastertableview>

</telerik:RadGrid>


Codebehind coding:

protected void GridRelateColumn_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                DataTable dtDDList = new DataTable();
                DataTable dttest = new DataTable();
                string definitionID = string.Empty;

                GridDataItem item = (GridDataItem)e.Item;
                dttest = (DataTable)item.OwnerTableView.DataSource;

                for (int i = 0; i < dttest.Rows.Count; i++)
                {
                    definitionID = dttest.Rows[i]["Source Column"].ToString();
                    if (definitionID != "" && definitionID != "1")
                    {
                        DropDownList dDownList = (DropDownList)item.FindControl("SourceDropDownList");
                        dtDDList = (DataTable)BLogic.BusinessComponents.RelateColumn.getAllColumnsByDefinitionID(new Guid(definitionID), new Guid(Session["ProjectID"].ToString()));
                        dDownList.DataSource = dtDDList;
                        dDownList.DataTextField = "ColumnName";
                        dDownList.DataValueField = "Selected_Column_GUID";
                        dDownList.DataBind();
                    }
                }
                for (int j = 0; j < dttest.Rows.Count; j++)
                {
                    definitionID = dttest.Rows[j]["Lookup Column"].ToString();
                    if (definitionID != "" && definitionID != "1")
                    {
                        DropDownList dDownList = (DropDownList)item.FindControl("LookUpDropDownList");
                        dtDDList = (DataTable)BLogic.BusinessComponents.RelateColumn.getAllColumnsByDefinitionID(new Guid(definitionID), new Guid(Session["ProjectID"].ToString()));
                        dDownList.DataSource = dtDDList;
                        dDownList.DataTextField = "ColumnName";
                        dDownList.DataValueField = "Selected_Column_GUID";
                        dDownList.DataBind();
                    }
                }
            }
        } 

For Example (please have a look at the below grid)

Source Column

Lookup Column

Filter Condition

Action

This drop down will show states of US

This drop down will show states of Europe

This drop down will shows years.(static data)

Edit

This drop down will show states of Brazil

This drop down will show states of India

This drop down will shows years.(static data)

Edit

This drop down will show states of Canada

This drop down will show states of Russia

This drop down will shows years.(static data)

Edit

This drop down will show states of China

This drop down will show states of Germany

This drop down will shows years.(static data)

Edit




Please help us as soon as possible. we need the solution or suggestion urgently.



Thanks
Alexis.

Veli
Telerik team
 answered on 25 Feb 2011
1 answer
75 views
There is strange text, that appears under the content area, when using RadEditor in Firefox modal window (i.e. Window, opened as modal from another window).

The text is:

"RadEditor - please enable JavaScript to use the rich text editor"

Thanks.
Rumen
Telerik team
 answered on 25 Feb 2011
7 answers
193 views
Hi, 
By default the uploaded files and the remove option display at the top. I would like to display the uploaded files and the corresponding remove options below or on the right hand side of the Select button control.  How to achieve this?  Attached are the original and desired layout for your reference.

Thanks.
Sebastian
Telerik team
 answered on 25 Feb 2011
4 answers
64 views
The Expand Icon doesn't change direction when R2L is applied, even though the icon is available in the Grid's sprite.gif.

Is this a confirmed bug? Is there a workaround?

Regards,
Andrew

Andrew
Top achievements
Rank 1
 answered on 25 Feb 2011
1 answer
89 views
Dear Telerik,

We have a RadTree that when you click any of its nodes, it opens a RadWindow containing a new dynamic page with a RadGrid, and RadToolbar. In the code behind, we're setting the:
 
radGrid.ClientSettings.ClientEvents.OnGridCreated = "GridCreated";

And in javascript we're setting focus to the grid:
function GridCreated(sender, args) {
     var currentGrid = $find(sender.ClientID);

      var row = currentGrid.get_masterTableView().get_selectedItems()[0];

 

 

      if (row)

 

            currentGrid.set_activeRow(row.get_element());

 

  currentGrid.Control.focus();
}

When you click any tree node, it hides any open window, then tries to locate the corresponding window to show:
1) If no window is found then it opens a new window populating it with a grid, and setting focus to the grid's first row correctly, and we can navigate using the keyboard.
2) If a window is found then it only shows that window, but the grid is losing focus, and we can't use keyboard navigation unless we click on the grid to activate it.

Is there any way to set focus to the grid in the second case above?

We tried to call the currentGrid.Control.focus(); but with no luck, we tried also

currentGrid.get_masterTableView().get_dataItems()[0].get_element().cells[0].focus();

and we could not make the grid to receive focus and we can't navigate using the keyboard.

Can you please help?

Salah A. Malaeb
TeknoBuild



Radoslav
Telerik team
 answered on 25 Feb 2011
3 answers
121 views
Hi all,
         if i am using two radgrid in a page, when i select a row in 1st grid the corresponding row should get selected in the another 2nd grid. Any assistance would be appreciated.  Thanks.
Princy
Top achievements
Rank 2
 answered on 25 Feb 2011
5 answers
477 views
Hi,

The problem that i am facing is, when i delete one row in grid, i need to do some checking then prompt it alert message in screen.
As i know, when we do deletion in grid, it only can call to code behind 

protected

void radImp_DeleteCommand(object source, Telerik.WebControls.GridCommandEventArgs e)

 

 

{

 

 

    string sOBFPkID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString();

    Utility.

BaseDelete.DeleteApplFacCollatREImprovement(sOBFPkID);

 

 

 

}
before i delete that record i need to do some checking first,if that record fulfill to my checking then i need to prompt a alert msg in screen.
How can i make it??
Thanks


Princy
Top achievements
Rank 2
 answered on 25 Feb 2011
1 answer
80 views
Hi there.
I have the following grid:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="true"
    GridLines="None" Width="100%" DataSourceID="ObjectDataSource1" meta:resourcekey="RadGrid1Resource1"
    OnItemDataBound="RadGrid1_ItemDataBound">
    <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" />
    <MasterTableView AutoGenerateColumns="False" DataSourceID="ObjectDataSource1">
        <Columns>
            <telerik:GridTemplateColumn meta:resourcekey="GridTemplateColumnResource1" UniqueName="TemplateColumn" AllowFiltering="false">
                <ItemTemplate>
                    <a href="Rightdata.aspx" onclick='openDataWindow('RightData.aspx?id=<%# Eval("ID") %>', 'RadWindow1'); return false;'>
                        <img alt="bearbeiten" style="border: 0;" src="img/scroll2_edit_24.png" title="bearbeiten" />
                    </a>
                    <asp:ImageButton ID="ImageButton2" runat="server" CommandArgument='<%# Eval("ID") %>'
                        CommandName="Delete" ImageUrl="img/scroll2_delete_24.png" meta:resourcekey="ImageButton2Resource1"
                        OnClick="ImageButton2_Click" />
                </ItemTemplate>
                <ItemStyle CssClass="style1" />
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="Name" HeaderText="Anzeigename" meta:resourcekey="GridBoundColumnResource1"
                SortExpression="Name" UniqueName="Name">
                <ItemStyle CssClass="style2" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="UniqueName" HeaderText="UniqueName" meta:resourcekey="GridBoundColumnResource2"
                SortExpression="UniqueName" UniqueName="UniqueName">
                <ItemStyle CssClass="style2" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Description" HeaderText="Beschreibung" meta:resourcekey="GridBoundColumnResource3"
                SortExpression="Description" UniqueName="Description">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn AllowSorting="False" DataField="ParentCategory" HeaderText="überg. Kategorie"
                meta:resourcekey="GridBoundColumnResource4" UniqueName="Category">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn AllowSorting="False" DataField="Category" HeaderText="Kategorie"
                meta:resourcekey="GridBoundColumnResource5" UniqueName="Category">
            </telerik:GridBoundColumn>
        </Columns>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldAlias="Kategorie" FieldName="ParentCategory" FormatString=""
                        HeaderText="" meta:resourcekey="GridGroupByFieldResource1" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldAlias="ParentCategory" FieldName="ParentCategory"
                        meta:resourcekey="GridGroupByFieldResource2" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldAlias="Unterkategorie" FieldName="Category" FormatString=""
                        HeaderText="" meta:resourcekey="GridGroupByFieldResource3" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldAlias="Category" FieldName="Category" meta:resourcekey="GridGroupByFieldResource4" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
    </MasterTableView>
</telerik:RadGrid>

If I turn on the AllowFilteringByColumn property the following error occurs:
Multiple controls with the ID FilterTyexBox_Category found. FindControl requires that controls have unique IDs.

What did I miss?
Martin
Telerik team
 answered on 25 Feb 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?