Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
172 views
Hi,

I have created a RadMenu in a RadGridTemplate column so that each row will have a RadMenu. I need to view/hide that RadMenu items acording to the permission.

What i did is I try to find the RadMenuItem in Grid_ItemDataBound event of the grid.

First I use  "FindItemByText" method. It works well.
  
 var radMenuMission = item.FindControl(RadMenuName) as RadMenu;                  
  
if (radMenuMission != null)                     {
     var radMenuItem = radMenuMission.FindItemByText(
"Delete");

But the problem is Text property is changed according to localized resources.
in that way Finding the RadMenuItem by Text is failed.

I need to use "FindItemByValue" method. I set "Value" attribute of the  RadMenuItem still i cant Find the menu Item. 

When I see the html code of the browser the Value property is missing.

Can anybody help for this ?

Thank you,

Dinesh
Dinesh
Top achievements
Rank 1
 answered on 08 Feb 2011
1 answer
97 views
Hi, I currently have my RadGrid setup with DetailTables, but I would like to switch to NestedView to have more control over the presentation of the data.  For my Detailtables I useOnDetailTableDataBind, but the NestedView doesn't have that property.  What is the best route take if I have a datasource that can only be generated programmatic?

<telerik:RadGrid ID="RadGrid1" runat="server"
    AllowSorting="True" GridLines="None" ShowGroupPanel="True"
    OnNeedDataSource="RadGrid1_NeedDataSource"
    OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
    AllowFilteringByColumn="True">
    <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView  DataKeyNames="ID" AllowMultiColumnSorting="True">
        <DetailTables>
            <telerik:GridTableView DataKeyNames="ID"  Width="100%"
                runat="server" AutoGenerateColumns ="false">
                <Columns>
                    <telerik:GridBoundColumn SortExpression="Joined" HeaderText="Joined" HeaderButtonType="TextButton"
                        DataField="Joined" UniqueName="Joined">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Status" HeaderText="Status" HeaderButtonType="TextButton"
                        DataField="Status" UniqueName="Status">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="City" HeaderText="City" HeaderButtonType="TextButton"
                        DataField="City" UniqueName="City">
                    </telerik:GridBoundColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <NestedViewSettings>
         
        </NestedViewSettings>
    </MasterTableView>
</telerik:RadGrid>
Princy
Top achievements
Rank 2
 answered on 08 Feb 2011
6 answers
186 views
Hi all,

I noticed that my dynamically created dock zones were falling outside of their container. I added a static dock zone and noticed that it too falls outside of this container. I'm at a loss.

<telerik:RadSplitter ID="RadSplitter1" Runat="server"
                 Width="100%" BorderSize="2" OnClientLoad="OnSplitterLoaded"
                BackColor="White" CssClass="RoundedStyle" Height="600px" Skin="Web20" >
                    <telerik:RadPane ID="RadPane1" Runat="server" Scrolling="None" Width="20px"
                        BackColor="#6086C1" >
                        <telerik:RadSlidingZone ID="RadSlidingZone1" Runat="server" ClickToOpen="True"
                            BackColor="#6086C1" Width="20px" Skin="Web20" >
                            <telerik:RadSlidingPane ID="RadSlidingPane1" Runat="server" Title="Settings"
                                Scrolling="Y" MinWidth="160"
                                Width="160px" BackColor="#ECF4FD" >
                                <telerik:RadListBox ID="lstBxSettings" runat="server" Skin="Web20"
                                    EnableDragAndDrop="True" ondropped="LstBxSettings_Dropped" Width="100%"
                                    style="top: 0px; left: 0px">
                                    <ButtonSettings TransferButtons="All" />
                                    <Items>
                                        <telerik:RadListBoxItem ListBox="lstBxSettings" Text="Horizontal Bar" />
                                        <telerik:RadListBoxItem ListBox="lstBxSettings" Text="Vertical Bar" />
                                    </Items>
                                </telerik:RadListBox>
                            </telerik:RadSlidingPane>
                            <telerik:RadSlidingPane ID="RadSlidingPane2" Runat="server" Title="Custom"
                                Scrolling="Y" MinWidth="160" BackColor="#ECF4FD">
                                <telerik:RadListBox ID="lstBxCustom" runat="server"
                        EnableDragAndDrop="True" ondropped="RadListBox_Dropped" Skin="Web20" Sort="Ascending"
                                    Width="100%">
                                    <ButtonSettings TransferButtons="All" />
                                </telerik:RadListBox>
                            </telerik:RadSlidingPane>
                            <telerik:RadSlidingPane ID="RadSlidingPane3" Runat="server" Title="Historical"
                                Scrolling="Y" MinWidth="160" Width="160px" BackColor="#ECF4FD" >
                                <telerik:RadListBox ID="lstBxHistorical" runat="server"
                        EnableDragAndDrop="True" ondropped="RadListBox_Dropped" Skin="Web20" Sort="Ascending"
                                    Width="100%">
                                </telerik:RadListBox>
                            </telerik:RadSlidingPane>
                        </telerik:RadSlidingZone>
                    </telerik:RadPane>
                    <telerik:RadPane ID="RadPane2" Runat="server" MinHeight="500"
                        BorderColor="White" Scrolling="None" CssClass="RoundedStyle">
                    </telerik:RadPane>
                </telerik:RadSplitter>

I thought it might be the fact that I had Pane1 on the LHS of my RadSplitter. I set its visibility to false, but the dockzone just grew in size and continued hanging over one edge. 

RadPane2's width is unset and the DockZone is housed inside of this. Could this be the problem? If so, what would a good solution be? I can't set the width in percentage, but that's what I would like to be doing. In addition, when inspecting the elements on the web page I found the width of RadPane2 to be correct.

The attached picture shows where the rounded corner looks fine inside the dockzone on the LHS, but because the dockzone extends too far on the RHS it gets chopped off. I also show the HTML markup where it is clear that the the RadPane is 1013 px (the width of the RadSplitter), but then the 100% width of the DockZone it is containing expands past it.

Thanks for your time,

Sean

EDIT: Sorry, there was something weird going on with my attachments. The image labeled "ActuallyCorrect.png" should be reflective of what I stated above.
Sean
Top achievements
Rank 2
 answered on 08 Feb 2011
1 answer
123 views
Hi,

I'm experimenting with using the ASP.NET AJAX RadScheduler in an MVC project which so far I have managed to implement with some rudimentary functionality and like what I see. We already have a middle tier which exposes schedule data via a WCF service returning what are essentially DTOs. I have seen examples of using a webservice that then talks to a data provider on the server and I see from this post:

http://www.telerik.com/community/forums/aspnet-ajax/scheduler/data-providers-and-web-services.aspx

that although it's possible to avoid writing a data provider the complications involved mean it probably makes the most sense to just implement a provider. Ideally I'd like to be able to simply invoke our WCF service from the client side and have the RadScheduler utilize the DTO instances returned. The DTO we return can be shaped to fit whatever the RadScheduler needs. Is this possible? I do see that there is the DataSource property where you can bind to an IEnumerable but it looks like that may not work in an MVC project and requires server side methods.

It may be feasible for us to have our WCF service invoke a custom data provider that simply then executes our normal code path from the custom RadScheduler data provider this then would look much like your WebService examples. I understand the data provider pattern and I like that you have used this approach but I was hoping to understand a little better what the WebServiceAppointmentController does before I go down this path. It does mean some complications because we have change tracking and other mechanisms in place to facilitate simply passing DTOs around for CRUD operations so mapping to your Appointment types means a lot of mapping between types etc.

Also, if you have any other suggestions for an approach given what I've described of our architecture, I'd appreciate your thoughts.

Thanks!
Kalina
Telerik team
 answered on 07 Feb 2011
2 answers
89 views
Hello,

       Anybody know if there is a way for me to use the RadNumericTextBox in Random Steps.

For example:

The textbox should take only these values: 0,  10, 55, 77, 90.

If RadNumericTextBox cannot be used, What are my alternatives other than using a combobox?

Sundeep
Sundeep Nadendla
Top achievements
Rank 1
 answered on 07 Feb 2011
1 answer
43 views
Hello,

When i have a row in edit mode and try to expand, I cant retrieve the parentitem's column value.

In RadGrid1_DetailTableDataBind:

when i do  e.DetailTableView.ParentItem("BondID").Text) it returns "&nbsp;"

This works fine if the row is not in edit mode.
Sadiq
Top achievements
Rank 1
 answered on 07 Feb 2011
2 answers
103 views
Hello,
I'm creating dynamic radgrid with dynamic columns names. The names all come from the database and can be either in English or in French. When a column's name contain a french character such as é à è ê ç... or if it contain ' or - a space is automatically added after the character witch odd result such as:
"Remplaç
ant"
or
"Anné
e"
or
"sous
-
code"
I tried to prevent text wraping this way:
grid.HeaderStyle.Wrap = false;
This way I don't get odd wrapping, but I still get space after those character, so it now looks like:
"Remplaç ant"
"Anné e"
"sous- code"
It's a little bit better but far from acceptable. The data binding is done this way (table been a DataTable):
grid.DataSource = table;
I tried to use Server.HtmlEncode() to make sure that the string is in the right format, but no luck... Since I'm using a DataTable, I don't think I can use TextBlock.  Any idea?

Thanks,
LP
Marco
Top achievements
Rank 1
 answered on 07 Feb 2011
1 answer
71 views
when i try to replace GridTemplateColumns with my customFilteredGridTemplateColumns the RadGrid isnt shown due to many bugs which seems irrelevant to Rad objects at all. what am i doing wrong? here is my implementation:

 

 

public class CustomFilteredGridTemplateColumn : GridTemplateColumn

 

{

 

 

public override GridColumn Clone()

 

{

 

 

return base.Clone();

 

}

 

 

protected override void SetupFilterControls(System.Web.UI.WebControls.TableCell cell)

 

{

 

 

base.SetupFilterControls(cell);

 

cell.Controls.RemoveAt(0);

cell.Controls.AddAt(0,

 

new TextBox());

 

}

 

 

public override bool SupportsFiltering()

 

{

 

 

return true;

 

}

 

 

protected override string GetFilterDataField()

 

{

 

 

return this.DataField;

 

}

 

 

protected override void SetCurrentFilterValueToControl(TableCell cell)

 

{

 

 

base.SetCurrentFilterValueToControl(cell);

 

(cell.Controls[0]

 

as TextBox).Text = this.CurrentFilterValue;

 

}

 

 

protected override string GetCurrentFilterValueFromControl(TableCell cell)

 

{

 

 

return (cell.Controls[0] as TextBox).Text;

 

}

}

Pavlina
Telerik team
 answered on 07 Feb 2011
3 answers
98 views
I have a RadGrid with a date column and several text columns and filtering enabled. When I select a date to be filtered, type text in one of the text fields and then select another filter field, the grid filters properly, but I can no longer type in the filter text fields.

I am using RadControls for ASP.NET Ajax Q2 2009.

Any suggestions?

My grid code is:
<telerik:RadGrid ID="ShipmentHistoryGrid" runat="server" Skin="Web20" OnNeedDataSource="OnShipmentHistoryGridNeedDataSource" 
    ShowStatusBar="True" AutoGenerateColumns="False" GridLines="None" OnItemDataBound="OnItemDataBound" 
    AllowFilteringByColumn="true" AllowSorting="true"
    <PagerStyle Mode="NextPrevAndNumeric" /> 
    <MasterTableView DataKeyNames="PackageID" CommandItemDisplay="None" TableLayout="Fixed"
        <Columns> 
            <telerik:GridDateTimeColumn FilterControlWidth="90px" DataField="ShippingDate" UniqueName="Date" 
                HeaderText="Ship Date" DataFormatString="{0:d}" AutoPostBackOnFilter="true" ShowFilterIcon="false"
                <HeaderStyle Width="95px" /> 
            </telerik:GridDateTimeColumn> 
            <telerik:GridBoundColumn DataField="Pin" UniqueName="Pin" HeaderText="Pin" AutoPostBackOnFilter="true" 
                CurrentFilterFunction="Contains" ShowFilterIcon="false" > 
                <HeaderStyle Width="100px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="ShortService" UniqueName="ServiceType" HeaderText="Service" 
                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="120px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Contact" UniqueName="Contact" HeaderText="Name" 
                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="100px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="City" UniqueName="City" HeaderText="City" AutoPostBackOnFilter="true" 
                CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="100px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn FilterControlWidth="30px" DataField="Province" UniqueName="Province" HeaderText="Province" 
                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="60px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="PostalCode" UniqueName="PostalCode" HeaderText="Postal Code" 
                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                <HeaderStyle Width="95px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridCheckBoxColumn DataField="IsVoid" UniqueName="IsVoid" Visible="false"
            </telerik:GridCheckBoxColumn> 
            <telerik:GridTemplateColumn UniqueName="VoidColumn" AllowFiltering="false" HeaderText="Void"
                <ItemTemplate> 
                    <asp:Button ID="btnVoid" runat="server" OnClick="OnClickVoid" Text="Void" /> 
                    <asp:Label ID="VoidLabel" runat="server" Text="Package Voided"></asp:Label> 
                </ItemTemplate> 
                <ItemStyle HorizontalAlign="Center"/> 
                <HeaderStyle HorizontalAlign="Center" /> 
            </telerik:GridTemplateColumn> 
        </Columns> 
    </MasterTableView> 
    <ClientSettings> 
        <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 
 
Martin
Telerik team
 answered on 07 Feb 2011
3 answers
80 views
hello,

im on an older version of RadControls for ASP.NET AJAX ("2009.2 826") but i think the answer to my question should be pretty straight-forward.

im using a RadGrid that uses WebUserControl for the grid's EditFormType. This .ascx form is displayed for Insertion and Update operations. my question -- in the user control's code-behind, how can i tell which mode the code is being executed as? i use this to show different things if the user is performing an Insert vs. an Update.

currently i use this code in the user control's .ascx.cs:

private void Page_PreRender(object sender, EventArgs e)
{
    //this is the only way i know how to check what mode this grid control is operating in.
    bool isGridInsertion = Object.ReferenceEquals(this.DataItem.GetType(), new GridInsertionObject(new ArrayList()).GetType() );
 
    if (isGridInsertion != true) //we check this because the below int assignment breaks on a grid insertion (since ProductTypeID has no value during our Insert form, only populated on Edit)
    {              
        int productTypeID = (int)DataBinder.Eval(this.DataItem, "ProductTypeID");
 
        // do stuff
    }
}

...is there a better way than doing the Object.ReferenceEquals on the DataItem's type (comparing it to a GridInsertionObject's type) ?


thanks!
matt
Martin
Telerik team
 answered on 07 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?