Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
90 views
Can someone please provide me some sample code of a treeview with a formatted template such as the following example:http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/templates/defaultvb.aspx but using dynamically added nodes from the code behind? 

I've managed to get nodes dynamically created and somewhat formatted using this example http://www.telerik.com/community/forums/aspnet-ajax/treeview/unexpected-behaviour-w-radtreeview-and-node-templates.aspx
but I'd like to be able to put a line break between a couple of custom attributes or format the line as a table.

Thanks.
Nikolay Tsenkov
Telerik team
 answered on 12 Jul 2011
3 answers
302 views
Hi,

I am using a Telerik Rad grid in my application from where I need to filter data from an expression which creates with selected multiple columns. In my grid there is a DateTimeColumn and other several columns to filter data. When I select each column separately filter is working but for selected multiple columns the filter expression is not working  well.  So I need to filter data from multiple columns with the filter expression.
Here is the code listing i have done with the grid.

protected void grdUserType_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            string Datakey = item.GetDataKeyValue("RegBy") == null ? "-1" : item.GetDataKeyValue("RegBy").ToString();
            DataRowView DataItem = (DataRowView)e.Item.DataItem;
            item["ActionType"].Text = string.Format("{0} ({1})", DataItem["ActionType"], DataItem["Description"]);              
            HyperLink hy = new HyperLink();
            hy.Text = item.GetDataKeyValue("FullName").ToString();
            hy.Attributes.Add("onclick", "javascript:calluserpopup('" + Datakey + "');return false;");
            hy.NavigateUrl = "#";
            hy.CssClass = "pagelinks";
            item["RegBy"].Controls.Add(hy);

            Label lblDt = (Label)item["RegDateOnly"].FindControl("lblDt");
            lblDt.Text = string.Format("{0}", Convert.ToDateTime(DataItem["RegDate"]));
        }
       
        if (e.Item is GridFilteringItem)
        {
            Control ctl = (e.Item as GridFilteringItem)["RegDateOnly"].Controls[1];
            RadDatePicker tbPattern = ctl as RadDatePicker;
            if (Session["OldPattern"] != null )
            tbPattern.SelectedDate = Convert.ToDateTime(Session["OldPattern"]);

        }
    }

protected void grdUserType_ItemCommand(object source, GridCommandEventArgs e)
     {
        switch (e.CommandName)
        {
            case RadGrid.FilterCommandName:
                System.Web.UI.Pair pair = (System.Web.UI.Pair)e.CommandArgument;
                if (pair.First.ToString() == "EqualTo" | pair.First.ToString() == "GreaterThan" | pair.First.ToString() == "LessThan" )
                {
                    if (pair.Second.ToString() == "RegDateOnly" )
                    {
                        DatePatternfunction = pair.First.ToString();
                        Control ctl = (e.Item as GridFilteringItem)["RegDateOnly"].Controls[1];
                       RadDatePicker tbPattern = ctl as RadDatePicker;

                        DateTime dt2 = tbPattern.SelectedDate.Value;

                        // Convert the date to date type of the database
                        string dt = dt2.ToString("d", new System.Globalization.CultureInfo("en-Gb"));
                        GridFilteringItem filterItem = (GridFilteringItem)e.Item;

                        string filterPattern = string.Empty;
                       
                        filterPattern = dt;
                        Session["filterPattern"] = filterPattern;
                        Session["OldPattern"] = string.Format("{0:d}", dt2.Date);
                               
                    }
                }
                if (pair.First.ToString() == "NoFilter")
                {
                    Session["filterPattern"] = null ;
                   Session["OldPattern"] = null;

               }
              break ;
        }
    } 

protected void grdUserType_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        if (Session["filterPattern"] != null)
        {
               string Expression = grdUserType.MasterTableView.FilterExpression;
           
               // To convert the date format which accepts the data base
               Expression = Expression.Replace(Session["OldPattern"].ToString(), Session["filterPattern"].ToString());

               grdUserType.MasterTableView.FilterExpression = Expression;
               DatePatternfunction = string.Empty; 
                Session["filterPattern"] = null;
        }
       // To get the data source to the grid
        grdUserType.DataSource = this.GetDataTable(1);
    }
Veli
Telerik team
 answered on 12 Jul 2011
10 answers
753 views
I am using the automatic inline edit/insert on a radgrid that is bound to an ObjectDataSource based on a business object.  Edits and deletes work great, but I am having problems getting the insert to work correctly.

Here are the columns in the radgrid:
<Columns> 
    <telerik:GridBoundColumn DataField="NoteID" DataType="System.Int32" HeaderText="NoteID" SortExpression="NoteID" UniqueName="NoteID" Visible="false" ReadOnly="true" /> 
    <telerik:GridDateTimeColumn DataField="NoteDate" DataType="System.DateTime" UniqueName="NoteDate" HeaderText="Date" HeaderStyle-Width="1" AllowSorting="true" DataFormatString="{0:M/d/yyyy}" />                                                 
    <telerik:GridBoundColumn DataField="Note" HeaderText="Note" SortExpression="Note" UniqueName="Note" /> 
    <telerik:GridBoundColumn DataField="UserID" DataType="System.Int32" HeaderText="UserID" SortExpression="UserID" UniqueName="UserID1" Visible="false" ReadOnly="true"   />            
    <telerik:GridBoundColumn DataField="StudentID" DataType="System.Int32" HeaderText="StudentID" SortExpression="StudentID" UniqueName="StudentID1" Visible="false" ReadOnly="true" />          
</Columns> 
 

Here is the ObjectDataSource:
<asp:ObjectDataSource ID="dsNotes" runat="server" DataObjectTypeName="StudentNote" TypeName="StudentNoteManager" DeleteMethod="Delete" InsertMethod="Save" SelectMethod="GetNotes" UpdateMethod="Save"
    <InsertParameters> 
        <asp:QueryStringParameter Name="StudentID" QueryStringField="sid" Type="Int32" /> 
        <asp:SessionParameter SessionField="UserID" Name="UserID" Type="Int32" /> 
    </InsertParameters> 
</asp:ObjectDataSource> 
 

When I do an insert, a new note is created, however, the 2 fields that should be set by the insert parameters are set to 0.

Am I missing something?
Veli
Telerik team
 answered on 12 Jul 2011
3 answers
117 views
When I attempt to export my master grid ( in a nested grid view) I get the following error in Telerik.Web.UI

"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object."

Has anyone else run into this issue ?

I configure the export as follows :

grdCMT.ExportSettings.ExportOnlyData =

 

true;

 

grdCMT.ExportSettings.IgnorePaging =

 

true;

 

grdCMT.ExportSettings.OpenInNewWindow =

 

true;

 

grdCMT.ExportSettings.HideStructureColumns =

 

true;

 

grdCMT.ExportSettings.FileName = lstrFileName;

Is it possible this is being caused because I am using RadWindows?


Daniel
Telerik team
 answered on 12 Jul 2011
1 answer
73 views
Hello

I had strange behaviour with this component, i added the ColorPicker into FormTemplate, everything works fine, when you select the custom color windows (it's showed and works fine), the problem arises when you close the FormTemplate and select again from de RadGrid the same file (element), the formtemplate editor it's showed, but when you try to access to change the customcolor from colorPicker the following error is showed:

Sys.InvalidOperationException: Two components with the same id 'ctl00_body_MasterGrid_ctl00_ctl05_HTMLColorPicker_millionCustomColorsSlider' can't be added to the application.

As I can understand the problem is due to there is created in somewhere this custom color window, there is any way to solve this? I had the v4.0.30319 (2011.1.519.40)

Thanks in advance
Niko
Telerik team
 answered on 12 Jul 2011
3 answers
142 views
I have a scenario where only a single sliding pane exists in a sliding zone. When this pane is docked, the tab is unecessary and justs wastes space, so I want to hide it. I have been using the following which has worked untill recently..

 function PaneDockedHandler() {  
                var slidingZone=$find("<%= szMyZone.ClientID %>");  
                var dockedPane = slidingZone.getPaneById(slidingZone.get_dockedPaneId());  
                  
                if (dockedPane) {  
                    dockedPane.hideTab();  
                }  
            }  
 
            function BeforePaneUndockedHandler(slidingZone) {  
                var slidingZone=$find("<%= szMyZone.ClientID %>");  
                var undockedPane = slidingZone.getPaneById(slidingZone.get_dockedPaneId());  
                if (undockedPane) {  
                    undockedPane.showTab();  
                }  
            } 

<telerik:RadSplitter ID="rsWB"   
                    runat="server"   
                    Height="100%" 
                    Width="100%" 
                    Orientation="Vertical"   
                    ResizeWithParentPane="False"   
                    ResizeWithBrowserWindow="True" 
                    BorderSize="0" 
                    VisibleDuringInit="False" 
                    Skin="Windows7" > 
             <telerik:radpane runat="server" id="lPane" Scrolling="None" Width="22px" Height="100%">  
                <telerik:RadSlidingZone id="szMyZone" runat="server" width="22px" Height="100%" SlideDuration="250">  
                    <telerik:RadSlidingPane id="spProcess" title="Process Properties" runat="server" width="200px" Height="100%" Scrolling="none" OnClientDocked="PaneDockedHandler" OnClientBeforeUnDock="BeforePaneUndockedHandler">  
 
                My Pane Content  
                    </telerik:RadSlidingPane> 
                </telerik:RadSlidingZone> 
                                          
                                          
            </telerik:radpane>     
<telerik:radpane runat="server" id="rPane" Scrolling="None" Width="100%" Height="100%">  
Right Pane Content  
</telerik:radpane>   
</telerik:RadSplitter >  

Since upgrading to more recent controls, now the pane docked/undocked handlers leave a space between the left and right panes equal to the width of the tabs. (see attached area shown in red). How can I get this to work with the latest controls?

BTW.. I think this ought to be the default behavior. When there is only a single sliding pane, the tabs are unecessary and should be hidden,
Dobromir
Telerik team
 answered on 12 Jul 2011
2 answers
163 views

 

Hi,
I am Using RadTreeList . In RadTreeList I  am Using InPlace Edit Mode And I am Trying to the update values by Using  RadTreeList1_UpdateCommand

The Above is event is fired and values are update on db but on the RadTreeList the updated value is not shown . I have to refresh or reload the page to see the updated value .

Please update on how to resolve this ASAP.

 

 <telerik:RadTreeList runat="server" ID="RadTreeList2" DataKeyNames="CloseOutID"  

ParentDataKeyNames="ParentID" AutoGenerateColumns="False"  

AllowMultiItemEdit="True" EditMode="InPlace" >  

 

<Columns>

 <telerik:TreeListEditCommandColumn UniqueName="EditCommandColumn" ShowAddButton="false" ButtonType="ImageButton">

 <ItemStyle CssClass="MyImageButton" />

 </telerik:TreeListEditCommandColumn>

 <telerik:TreeListBoundColumn DataField="CloseOutID"

 HeaderText="CloseOut ID" UniqueName="CloseOutID" Visible ="false" ReadOnly="true" />

 <telerik:TreeListTemplateColumn ReadOnly="true" >

 <HeaderTemplate>

 <asp:Label ID="lblheaderRetentionOutputFile" runat="server" Text="RetentionOutputFile"></asp:Label>

 </HeaderTemplate>

 <ItemTemplate >

 <asp:HyperLink ID="hlinkRetentionOutputFile" Visible="true" NavigateUrl='<%# Eval("RetentionOutputFile") %>' runat="server">Browse</asp:HyperLink>

 <asp:Image ID="imgRetentionOutputFile" Visible ="false" ImageUrl="~/Images/folder.gif" runat="server" />

 </ItemTemplate>

 </telerik:TreeListTemplateColumn>

 <telerik:TreeListTemplateColumn >

 <HeaderTemplate>

 <asp:Label ID="lblStatus" runat="server" Text="Status" ></asp:Label>

 </HeaderTemplate>

 <ItemTemplate>

 <asp:HiddenField ID="hdfStatusCode" runat="server" Value='<%# Eval("StatusCode") %>' />

 <asp:Label ID="lblStatusMessage" runat="server" Text='<%# Eval("Status") %>' ></asp:Label>

 <asp:Button ID="btnActivate" runat="server" Text="Activate" Visible="false" CommandName="Activate" CommandArgument='<%# Eval("TaskID") %>' />

 </ItemTemplate>

 <EditItemTemplate>

 <asp:HiddenField ID="hdfStatusCode" runat="server" Value='<%# Eval("StatusCode") %>' />

 <asp:Label ID="lblStatusMessage" runat="server" Text='<%# Eval("Status") %>' ></asp:Label>

 <asp:Button ID="btnActivate" runat="server" Text="Activate" Visible="false" CommandName="Activate" CommandArgument='<%# Eval("TaskID") %>' />

 </EditItemTemplate>

 </telerik:TreeListTemplateColumn>

 <telerik:TreeListTemplateColumn >

 <HeaderTemplate>

 <asp:Label ID="lblExpiryDate" runat="server" Text="Expiry Date"></asp:Label>

 </HeaderTemplate>

 <ItemTemplate>

 <asp:Label ID="lblExpirationDate" runat="server" Text='<%# Eval("ExpirationDate") %>'></asp:Label>

 </ItemTemplate>

 <EditItemTemplate>

 <asp:HiddenField ID="hdfJobID" runat="server" Value='<%# Eval("JobID") %>' />

 <asp:TextBox ID="txtExpirationDate" Width="100px" CssClass="radEnabledCss_Default" Text='<%# Eval("ExpirationDate", "{0:d}") %>'

 onclick="showPopup(this, event);" onfocus="showPopup(this, event);" onblur="parseDate(this, event)"

 runat="server" >

 </asp:TextBox>

 </EditItemTemplate>

 </telerik:TreeListTemplateColumn>

 </Columns>

 </telerik:RadTreeList>

 

 

Veli
Telerik team
 answered on 12 Jul 2011
0 answers
89 views

Hi,

I have one combobox in Grid and i want to show this combobox as Multiple Rows and column and i am using the following css for this combobox

.multipleRowsColumns .rcbItem,
.multipleRowsColumns .rcbHovered
{
    float:left;
    margin:0 1px;
    min-height:13px;
    overflow:hidden;
    padding:2px 19px 2px 6px;
    width:125px;
}

This style sheet is not woking for combobox that is in grid.

Can anyone tell me the css that will apply to the combobox so that i can get the combobox as Multiple row and column in grid ?

Thanks,
--Jai


Jai
Top achievements
Rank 1
 asked on 12 Jul 2011
2 answers
49 views
I jave edit button on my raddatagrid
   <telerik:GridEditCommandColumn HeaderText="Edit" UniqueName="paramsEditCollumn">
  </telerik:GridEditCommandColumn>

When i trying to do an edit with http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx - its not working. Most funny that it is working only if im step-bysteb debugging javascript doubleclick function, or making alert($find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow));

When im trying to do this with the help of postback:

   function RowDblClick(sender, eventArgs) {
              
               __doPostBack("<%= RadGrid1
.UniqueID %>", "RowDblClicked:" + eventArgs.get_itemIndexHierarchical());
            }

    protected override void RaisePostBackEvent(IPostBackEventHandler source, string eventArgument)
    {
        base.RaisePostBackEvent(source, eventArgument);
        if (source == this.rgParams && eventArgument.IndexOf("RowDblClicked") != -1)
        {
            GridDataItem item = rgParams.Items[int.Parse(eventArgument.Split(':')[1])];
            item.Edit=true;
            rgParams.Rebind();
        }
    }  


Its not working too.

lol

whats wrong with this dg?

Devs give pls answer.
Vasil
Telerik team
 answered on 12 Jul 2011
1 answer
56 views
Hello,

I have a combobox with the following:
    AllowCustomText = False
    Filter = Contains
    IsCaseSensitive = False
    MarkFirstMatch = True
    OpenDropDownOnLoad = True

When I type something into the text area, the list of items shrinks to what matches what I've typed in so far.  I can then select from a smaller list the item I want.  This all works fine.

My problem is that I need to somehow erase what I typed in but not what I selected.  I need to do this so that when I click on the drop-down again, all items are shown and not only the ones that had what I typed in them.

I cannot seem to find cbox.filterExpression or cbox.currentFilterValue to reset to "".

I am using version 2010.3.1317.35.

Any help would be very appreciated!!!

Thanks,
Susan
Dimitar Terziev
Telerik team
 answered on 12 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?