Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
715 views
Hi,

I have an EditFormSettings section in my RadGrid control which uses a FormTemplate. The FormTemlate contains multiple of RadTextBox controls and currently the only way to navigate through the controls is using the Tab key. Is there anyway to change the Enter key to behave like the Tab key in edit mode?

i.e. OnClientKeyPressing:
if (window.event.keyCode == 13) {
window.event.keyCode = 9;
}


Thank you!


Marius
Top achievements
Rank 1
 answered on 10 Oct 2014
1 answer
153 views
I have a enabled DropDownAutoWidth on my combobox but it seems to stay fixed width.  As you can see in the snapshot attached, the description in the last column word wraps instead of extending all the way.  Am I missing some settings?
<asp:Label ID="Label8" runat="server" Width="100px" Style="padding-left:22px" Text="Market:"  />
    <telerik:RadComboBox ID="RadMarketComboBox" runat="server" Width="80px" Height="150px" DataSourceID="SqlDataSourceMarket" DataTextField="market_cd" DataValueField="market_cd" EnableScreenBoundaryDetection="true" DropDownAutoWidth="Enabled"
        HighlightTemplatedItems="true" MarkFirstMatch="true" SelectedValue='<%# DataBinder.Eval(Container, "DataItem.market").ToString().Trim() %>'  >
        <HeaderTemplate>
            <table>
                <tr>
                    <td class="col1">Market</td>
                    <td class="col2">Desc</td>
                </tr>
            </table>
        </HeaderTemplate>
        <ItemTemplate>
            <table>
                <tr>
                    <td class="col1">
                        <%# DataBinder.Eval(Container.DataItem, "market_cd") %>
                    </td>
                    <td class="col2">
                        <%# DataBinder.Eval(Container.DataItem, "market_desc") %>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </telerik:RadComboBox>
    <asp:SqlDataSource ID="SqlDataSourceMarket" runat="server"
        ConnectionString="<%$ ConnectionStrings:OSS %>"
        SelectCommand="SELECT rtrim(ltrim(market_cd)) as market_cd, rtrim(ltrim(market_desc)) as market_desc, market_id
            FROM market
            ORDER BY market_cd">
    </asp:SqlDataSource><br />

Thank you,

Helen


Magdalena
Telerik team
 answered on 10 Oct 2014
2 answers
515 views
Hi,

I am using 2 level telerik radgrid to display information for purchase order(PO) and purchase order(PO) line items. I already have export to excel which exports the data into an excel sheet including the filters applied on the grid. i.e when we apply a filter on grid and click on export it only exports the data present in the filtered grid.

I have a new requirement to export the grid data into multiple worksheet in the single excel file. i.e. PO information should be exported to 1st worksheet in the excel file and PO line items information should be exported to 2nd worksheet in the same excel file. I also need to change the header information in the export. e.g. PurchaseOrderId will be renamed to PoId and so on. When a filter is applied it should only export the filtered information.
Please let me know if this is feasible. If yes, it would be great if sample code can be included. Any help would be appreciated. Thanks in advance. 

Please find some more details for current implementation. 
<telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="false" AllowPaging="True" AllowFilteringByColumn="true"
        runat="server" AllowSorting="true" OnNeedDataSource="RadGrid1_NeedDataSource" GroupingSettings-CaseSensitive="false"
        GridLines="None" EnableLinqExpressions="false" ExportSettings-IgnorePaging="True" ExportSettings-Excel-Format="Html"
        MasterTableView-CommandItemDisplay="Top" ExportSettings-ExportOnlyData="true" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
        OnItemCommand="RadGrid1_OnItemCommand"> 
          <MasterTableView  DataKeyNames="PurchaseOrderId">
             <DetailTables>
                 <telerik:GridTableView runat="server" DataKeyNames="PurchaseOrderItemId" Name="1" Width="100%" HierarchyLoadMode="Client" AllowSorting="False" AllowFilteringByColumn="False">
                   <Columns>
                         <telerik:GridBoundColumn ...... ></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn ...... ></telerik:GridBoundColumn>
                   </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                    <telerik:GridBoundColumn ...... ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ...... ></telerik:GridBoundColumn>
          </Columns>
            <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"
                ShowRefreshButton="false" />
        </MasterTableView>
        <GroupingSettings CaseSensitive="false" />
    </telerik:RadGrid>

Thanks.
Ank
Top achievements
Rank 1
 answered on 10 Oct 2014
1 answer
196 views

Hi,I have created a button to simulate clicking the arrow on a combobox.
Basically I hide the combobox and call the javascript to triggers the dropdown behavior of the combobox when a user clicks on the button.
The user will be able to select an item from the dropdown and then the code-behind will populate the selected address into the textboxes accordingly.Everything works ok up to this point. The problem starts after the postback, data in the dropdown list is gone.
I found a few posts on the forum which says we need to load the data on each post back or in the ItemsRequested event but that didn't work for me.
I must be missing something obvious, but just can't spot it.  Please help~

javascript :
     Since the combobox is in a user control, I load the javascript using ScriptManager.

code-behind:
protected void Page_Load(object sender, EventArgs e)
{
 
    //  Load script dynamically for user control
    StringBuilder script = new StringBuilder();
    script.Append("function ShowDropDownFunction() {");
    script.Append("var combo = $find('" + RadLogixBuildingComboBox.ClientID + "');");
    script.Append("combo.showDropDown(); }");
    ScriptManager.RegisterStartupScript(Page, typeof(Page), "script1", script.ToString(), true);
 
    SALTLeadDetailsBLL _detailBLL = new SALTLeadDetailsBLL();
    SALTLeadDetailsDAL.sbms_bldgDataTable dt = _detailBLL.GetLogixBuildings(SalesID);
    RadLogixBuildingComboBox.DataSource = dt;
    RadLogixBuildingComboBox.DataBind();
}
 
protected void RadLogixBuildingComboBox_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
{
    DataRowView dataItem = (DataRowView)e.Item.DataItem;
 
    e.Item.Text = dataItem["bldgstreet1"].ToString().Trim() + "; " + dataItem["bldgcity"].ToString().Trim() + "; " + dataItem["bldgstate"].ToString().Trim() + "; " + dataItem["bldgzip"].ToString().Trim() + "; " + dataItem["market"].ToString().Trim();
    e.Item.Value = dataItem["bldgstreet1"].ToString().Trim() + "; " + dataItem["bldgcity"].ToString().Trim() + "; " + dataItem["bldgstate"].ToString().Trim() + "; " + dataItem["bldgzip"].ToString().Trim() + "; " + dataItem["market"].ToString().Trim();
}
 
 
protected void RadLogixBuildingComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    //  When loadondemand is turned on, SelectedItem is not available : http://www.telerik.com/forums/combobox-selecteditem-getting-null-even-when-it-is-selected-from-the-list
    //  Use e.item.text and e.item.value in ItemDataBound event
    String selectedItemValues = RadLogixBuildingComboBox.SelectedValue;
    List<string> itemValues = selectedItemValues.Split(';').ToList();
 
    string[] zipCode = itemValues[3].Trim().Split('-');
    string zip = zipCode[0].ToString().Trim();
    string zipExt = zipCode[1].ToString().Trim();
    Address1TextBox.Text = itemValues[0].ToString().Trim();
    CityTextBox.Text = itemValues[1].ToString().Trim();
    StateTextBox.Text = itemValues[2].ToString().Trim();
    ZipTextBox.Text = zip;
    ZipExtTextBox.Text = zipExt;
    RadMarketComboBox.SelectedValue = itemValues[4].ToString().Trim();
 
 
}
 
protected void RadLogixBuildingComboBox_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
    SALTLeadDetailsBLL _detailBLL = new SALTLeadDetailsBLL();
    SALTLeadDetailsDAL.sbms_bldgDataTable dt = _detailBLL.GetLogixBuildings(SalesID);
    RadLogixBuildingComboBox.DataSource = dt;
    RadLogixBuildingComboBox.DataBind();
}

ascx :

<telerik:RadButton ID="LogixBuildingImageButton" AutoPostBack="false" runat="server"  Image-ImageUrl="~/images/building16.png" ToolTip="Logix Buildings" Width="16px" Height="16px" OnClientClicked="ShowDropDownFunction" />
<telerik:RadComboBox ID="RadLogixBuildingComboBox" runat="server" AutoPostBack="true"   MarkFirstMatch="false" ItemsPerRequest="5" ShowMoreResultsBox="true"
        EnableAutomaticLoadOnDemand="true" EnableVirtualScrolling="true"
        DropDownAutoWidth="Disabled" DropDownWidth="700px" Width="0" Height="150px" HighlightTemplatedItems="true"  EnableScreenBoundaryDetection="true"
        OnItemDataBound="RadLogixBuildingComboBox_ItemDataBound"  OnSelectedIndexChanged="RadLogixBuildingComboBox_SelectedIndexChanged" OnItemsRequested="RadLogixBuildingComboBox_ItemsRequested" >
    <HeaderTemplate>
        <table>
            <tr>
                <td class="logixbuildingcol1">Building Street</td>
                <td class="logixbuildingcol2">City</td>
                <td class="logixbuildingcol3">State</td>
                <td class="logixbuildingcol4">Zip</td>
                <td class="logixbuildingcol5">Status</td>
                <td class="logixbuildingcol6">Address Type</td>
            </tr>
        </table>
    </HeaderTemplate>
    <ItemTemplate>
        <table>
            <tr>
                <td class="logixbuildingcol1"><%# DataBinder.Eval(Container.DataItem, "bldgstreet1") %> </td>
                <td class="logixbuildingcol2"><%# DataBinder.Eval(Container.DataItem, "bldgcity") %></td>
                <td class="logixbuildingcol3"><%# DataBinder.Eval(Container.DataItem, "bldgstate") %></td>
                <td class="logixbuildingcol4"><%# DataBinder.Eval(Container.DataItem, "bldgzip") %></td>
                <td class="logixbuildingcol5"><%# DataBinder.Eval(Container.DataItem, "buildingStatus") %></td>
                <td class="logixbuildingcol6"><%# DataBinder.Eval(Container.DataItem, "addressTypeDesc") %></td>
            </tr>
        </table>
 
    </ItemTemplate>
    <FooterTemplate>
        <table>
            <tr>
                <td class="logixbuildingcol1"><telerik:RadButton ID="RadCloseButton" runat="server" AutoPostBack="false" Text="Close" Icon-PrimaryIconUrl="~/images/exit_16x16.png" OnClientClicking="HideDropDownFunction()" /></td>
            </tr>
        </table>
    </FooterTemplate>
</telerik:RadComboBox>

Thank you,

Helen










     
Peter Filipov
Telerik team
 answered on 10 Oct 2014
3 answers
189 views
I have a RadGrid that has a RadAsyncUpload control int  the edit item template :

   <telerik:GridTemplateColumn DataField="Data" HeaderText="Image" UniqueName="Upload">
                                    <ItemTemplate>
                                        <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("Data") %>'
                                            AutoAdjustImageControlSize="false" Height="40px" ImageUrl="~/images/icons/PDF.png"></telerik:RadBinaryImage>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" OnClientFileUploaded="OnClientFileUploaded"
                                            AllowedFileExtensions="jpg,jpeg,png,gif,pdf,tiff,tif" MaxFileSize="1048576" OnFileUploaded="AsyncUpload1_FileUploaded"  MaxFileInputsCount="1" ChunkSize="0">
                                        </telerik:RadAsyncUpload>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>

When testing through Visual Studio it performs like a charm.  However as soon as I publish it for UAT the input field of the upload control is duplicated. See attached screenshots. I have tried all edit modes... Any ideas out there?
Angel Petrov
Telerik team
 answered on 10 Oct 2014
2 answers
97 views
Hi

I use the radSlider but I dont understand the use of Skin PBS, The slider is not show the style,  the follow code

<link href="Skins/PlayBallSkin/Slider.PBS.css" rel="stylesheet" type="text/css" />


My question where is this file? or Where add this fie


Thanks & regards
Gustavo
Top achievements
Rank 1
 answered on 09 Oct 2014
3 answers
381 views
Hi everyone,

I'm having an issue trying to add rich content to a RadNotification created dynamically. I'm developing ASP.NET Composite Server Controls that nests Telerik controls and it is imposible to add any control to the RadNotification's ContentTemplate/ContentContainer. This is my code:

protected override void CreateChildControls()
{
    var _notification = new RadNotification
    {
        ID = "Notification",
        Position = NotificationPosition.Center,
        Height = Unit.Pixel(160),
        Width = Unit.Pixel(330),
        TitleIcon = "ok",
        Animation = NotificationAnimation.Slide,
        AutoCloseDelay = 0,
        ShowCloseButton = false,
    };
    var div = new HtmlGenericControl("div");
    div.Controls.Add(new LiteralControl("<br />"));
    div.Controls.Add(new Literal { Text = Resources.MyControl_TextMessage });
    div.Controls.Add(new LiteralControl("<br />"));
    div.Controls.Add(new RadButton { Text = Resources.MyControl_ButonText });
    _notification .ContentContainer.Controls.Add(div);
    this.Controls.Add(_notification);
}

BTW, this is not the full method, full method contains a lot of more controls, this is just a sample.

Hope anyone knows how can I achieve it.

Thanks,
Nefi
Meera
Top achievements
Rank 1
 answered on 09 Oct 2014
5 answers
110 views
How do you avoid file names with &, ', etc? If these are image files the browser chokes on them. We need to have them renamed during the upload. Nothing I am trying seems to work. I tried to simply copy the original file to the new name in the postback and that doesn't work either. I get an error that it cannot find the file.
Hristo Valyavicharski
Telerik team
 answered on 09 Oct 2014
0 answers
98 views
In a scenario, RadMenu is present in a user control. This user control is bind in the master page of the application. Hence all content pages have this menu. I need refresh only the RadMenu (not the entire page) from the content pages. I did wrap up the RadMenu with an updatepanel. So from my content page via Javasscript (I need to make the refresh via JS)  when I am calling __doPostBack('updatepanel',''). The updatepanel gets call & it reloads it. Since the UserControl(having the RadMenu) is inside the UpdatePanel the same gets called & a postback is incurred in it. This calls the function responsible for populating the menu. However, this time it gives an exception :     

Error: Microsoft
JScript runtime error: Sys.ArgumentTypeException: Object of type
'Telerik.Web.UI.RadMenu' cannot be converted to type 'Sys.UI.Control'.
Parameter
name: instance

Help:
​ - Need to overcome this error    OR   find a different way to handle the above scenario. Any immediate help would be great. 
Soumadeep
Top achievements
Rank 1
 asked on 09 Oct 2014
1 answer
107 views
Im very new at using Telerik so pleas bare with me.

ive been trying to follow this
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/edit-form-types/defaultcs.aspx
Here's my problem, im using EditForms as Editmode of my Radgrid but the difference is that my radgrid has a child grid
but everytime I click on edit button on the child grid the child grid becomes missing, and will only show up again when I retract and expand again the parent grid, only then the editform together with the child rid is shown, but still the details of the child grid is gone, please see the attached image for a better picture of whats happening.

ASPX
<telerik:RadGrid ID="rgParent" OnNeedDataSource="rgParent_NeedDataSource"
02.                                OnItemCommand="rgParent_ItemCommand" OnItemDataBound="rgParent_ItemDataBound"
03.                                OnItemCreated="rgParent" runat="server" PageSize="20" AllowSorting="True"
04.                                AllowMultiRowSelection="True" AllowPaging="True" AutoGenerateColumns="False"
05.                                GridLines="none" ShowStatusBar="true" EnableViewState="true"
06.                                Width="1183px" ClientIDMode = "Static" >
07.                                <GroupingSettings  ShowUnGroupButton="True"/>
08.                                <MasterTableView AllowMultiColumnSorting="True" DataKeyNames="DataSource"
09.                                    Width="100%">
10.                                     <Columns>
11.                                        <telerik:GridBoundColumn DataField="Column1"
12.                                            FilterControlAltText="Column1" HeaderButtonType="Column1"
13.                                            HeaderText="Column1" SortExpression="Column1" UniqueName="Column1"
14.                                            Visible="False">
15.                                            <HeaderStyle VerticalAlign="Top" />
16.                                        </telerik:GridBoundColumn>
17.                                        <telerik:GridBoundColumn DataField="Column2"
18.                                            FilterControlAltText="Column2"
19.                                            HeaderButtonType="Column2" HeaderText="Column2" SortExpression="Column2"
20.                                            UniqueName="Column2">
21.                                        </telerik:GridBoundColumn>
22.                                    </Columns>
23.                                    <NestedViewTemplate>
24.                                        <asp:Panel ID="pnlChild" runat="server" CssClass="viewWrap"
25.                                            Visible="true">
26.                                            <telerik:RadGrid ID="rgChild" runat="server"
27.                                                AllowMultiRowSelection="true" AllowPaging="True" AllowSorting="True"
28.                                                AutoGenerateColumns="False" EnableViewState="true" GridLines="None"
29.                                                OnItemCommand="rgChild_ItemCommand"
30.                                                OnItemCreated="rgChild_ItemCreated"
31.                                                OnItemDataBound="rgChild_ItemDataBound"
32.                                                OnNeedDataSource="rgChild_NeedDataSource" PageSize="7"
33.                                                ShowStatusBar="true" Width="95%">
34.                                                <MasterTableView AllowMultiColumnSorting="True" DataKeyNames="Column1"
35.                                                     EnableViewState="true" HierarchyLoadMode="ServerOnDemand"
36.                                                    Width="100%" EditMode="EditForms">
37.                                                    <Columns>
38.                                                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
39.                                                        </telerik:GridEditCommandColumn>
40.                                                        
41.                                                           <COLUMNS GOES HERE>
42.
43.                                                    </Columns>
44.                                                    <EditFormSettings EditFormType="Template">
45.                                                        <FormTemplate>
46.                                                            <table border="0" cellpadding="1" cellspacing="2" rules="none"
47.                                                                style="border-collapse: collapse;" width="100%">
48.                                                                <tr>
49.                                                                    <td>
50.                                                                        <table border="0" cellpadding="1" cellspacing="1" class="module"
51.                                                                            width="250">
52.                                                                            <tr>
53.                                                                                <td>
54.                                                                                </td>
55.                                                                                <td>
56.                                                                                </td>
57.                                                                            </tr>
58.                                                                            <tr>
59.                                                                                <td>
60.                                                                                    Note:
61.                                                                                </td>
62.                                                                                <td>
63.                                                                                    "A TEXT BOX HERE"
64.                                                                                </td>
65.                                                                            </tr>
66.                                                                            <tr>
67.                                                                                <td>
68.                                                                                    Process:
69.                                                                                </td>
70.                                                                                <td>
71.                                                                                  A TEXT BOX HERE
72.                                                                                </td>
73.                                                                            </tr>
74.                                                                        </table>
75.                                                                    </td>
76.                                                                </tr>
77.                                                                <tr>
78.                                                                    <td align="right" colspan="2">
79.                                                                        BUTTON
80.                                                                         
81.                                                                        ANOTHER BUTTON
82.                                                                    </td>
83.                                                                </tr>
84.                                                            </table>
85.                                                        </FormTemplate>
86.                                                    </EditFormSettings>
87.                                                </MasterTableView>
88.                                            </telerik:RadGrid>
89.                                        </asp:Panel>
90.                                    </NestedViewTemplate>
91.                                </MasterTableView>
92.                            </telerik:RadGrid>


C#
protected void rgViewBPAYParent_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            try
            {
               <Some codes here>
                rgViewBPAYParent.DataSource = ds.Tables[0];
                 
                 
            }
            catch (Exception ex)
            {
                
            }
 
 protected void rgParent_ItemCreated(object sender, GridItemEventArgs e)
        {
 
            try
            {
 
                if (e.Item is GridNestedViewItem)
                {
                   some codes here
 
               
                    if (gridID != null)
                    {
                        RadGrid grid = (RadGrid)e.Item.FindControl("rgChild");
                        grid.Visible = true;
                        grid.DataSource = null;
                        grid.Rebind();
                    }
                }
            }
            catch (Exception ex)
            {
                
            }
 
            return;
 
        }
 
 
 
 protected void rgViewBPAYNested_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
             try
            {
 
                   
               if(!IsPostBack)
                 {
 
                    <some codes here>
 
                    dataSet = List.GetBySearch();
 
                    innerGrid.DataSource = dataSet.Tables[1];
                }
            }
             catch (Exception ex)
             {
                 
             }
        }


pardon me, I hope everything you need are provided for my problem, let me know if you have a question.. thanks in advance to whoever tries to help me. 
Konstantin Dikov
Telerik team
 answered on 09 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?