Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
790 views
How and where can you check a RadComboBox for a value? I am getting an error because I am trying to set the selected value of my RCB to a value in my grid that I use databinder to get at. If the value is not in the original dataset I bound to my RCB it errors out. What I want to do is when I open my custom edit form that has this RCB in it, check to see if the value from the grid exists in the available items of the RCB. I cannot add it as it is no longer a valid option but my client keeps it for historical records. I am calling the following code in the pageLoad method but it is not working as it seems as if the RCB data items are not available here.

    myDDL.DataTextField = ds.Tables[0].Columns["DATA"].ToString();
    myDDL.DataValueField = ds.Tables[0].Columns[0].ToString();
    myDDL.DataSource = ds.Tables[0];
 
    var myValue = String.Empty;
    var ddlValue = DataBinder.Eval(DataItem, "DATA");
    Session["ddlValue"] = ddlValue;
    myValue = Session["ddlValue"].ToString();
    
    if (DataItem != null)
    {
        if (myDDL.FindItemByValue(ddlValue.ToString()) == null)
        {
            myDDL.SelectedIndex = -1;
        }
        else
        {
            myDDL.SelectedValue = ddlValue.ToString();
        }
    }
    else
    {
        myDDL.SelectedValue = myValue;
    }
}
Plamen
Telerik team
 answered on 01 May 2013
5 answers
1.1K+ views
Hi,

I want to avoid double clicks on the Insert button as it cause duplicate entry.
I have checked in the InsertCommand event that the user clicked twice but if I cancel the event - none of the entry is saved to the DB.

How can I avoid this?
Kostadin
Telerik team
 answered on 01 May 2013
5 answers
65 views
How would you add to the QAT using XML and how you you add items from the Application Toolbar to your QAT?
Bozhidar
Telerik team
 answered on 01 May 2013
2 answers
100 views
There is an issue where the contents of the controls spill over the size of the window if it is being called for the first time (like an insert or update event). However every subsequent call the window seems to adjust to the perfect height. Any thoughts on how to solve this issue? 

<telerik:RadGrid ID="rgContacts" runat="server" AutoGenerateColumns="False" OnNeedDataSource="rgContacts_NeedDataSource" Skin="Silk"
    ShowHeader="false" GridLines="None" BorderStyle="Groove" BorderWidth="1px" Width="250px" BorderColor="#555555"
    AlternatingItemStyle-BackColor="White" BackColor="#bbeaf3">
    <MasterTableView DataKeyNames="contact_id" EditMode="PopUp">
    <CommandItemSettings ShowRefreshButton="false" AddNewRecordText="Add a New Contact"/>
    <EditFormSettings PopUpSettings-Modal="true" UserControlName="controls/Contacts/CustomerContact.ascx" EditFormType="WebUserControl"  InsertCaption="Create New Contact" CaptionFormatString="Edit Contact" FormCaptionStyle-Font-Bold="true" FormCaptionStyle-Font-Size="X-Large" FormStyle-BackColor="#dedddc" />
Angel Petrov
Telerik team
 answered on 01 May 2013
3 answers
350 views

Hi,

My requirement is to export RadGrid data to excel when user clicks on button outside RadGrid.

The following are the customizations that are needed:

1) Save or Open dialogue box should show up for opening or saving excel file.
2) Add company logo to excel file at certain position. Like row1 column1 to row5 column5. Logo size (gif format) is
      always going to be same. Currently we are doing it by accessing worksheet and adding it.
3) we should be able to specify from where data should start showing up like row7..
4) We are hiding some columns in the grid. When exported, these shouldn't be exported.
5) Some rows in the grid are disabled. User can't click them. They shouldn't be exported.
6) Add a title and format it.
7) Format print options like margin etc..

I appreciate your help. Please let me know if there are any links about how to take care of it.

Thanks,
Prathiba.

Kostadin
Telerik team
 answered on 01 May 2013
1 answer
162 views
I created a gauge and set the pointer value when the users saves information.  For some reason, when the page posts back, the gauge loses it's original formatting and goes to a default.  Does anyone know why it does this?

I do not set formatting in anyway in the code behind.  Just the pointer value.

radGuage.Pointer.Value =

Convert.ToDecimal(7.5);

 

<

 

telerik:RadRadialGauge ID="radGuage" runat="server" Skin="WebBlue">

 

 

 

 

 

<Pointer Color="Green">

 

 

 

 

 

<Cap Color="Lime" />

 

 

 

 

 

</Pointer>

 

 

 

 

 

<Scale MajorUnit="1" Max="8" Min="1" MinorUnit=".5">

 

 

 

 

 

<Labels Color="Black" Position="Outside" Visible="False" />

 

 

 

 

 

<Ranges>

 

 

 

 

 

<telerik:GaugeRange Color="#ccffcc" From="1" To="2" />

 

 

 

 

 

<telerik:GaugeRange Color="#99ccff" From="2" To="3" />

 

 

 

 

 

<telerik:GaugeRange Color="#0067b4" From="3" To="4" />

 

 

 

 

 

<telerik:GaugeRange Color="#826eb1" From="4" To="5" />

 

 

 

 

 

<telerik:GaugeRange Color="#ffff99" From="5" To="6" />

 

 

 

 

 

<telerik:GaugeRange Color="#ff9900" From="6" To="7" />

 

 

 

 

 

<telerik:GaugeRange Color="#ff6666" From="7" To="8" />

 

 

 

 

 

</Ranges>

 

 

 

 

 

</Scale>

 

 

 

 

 

</telerik:RadRadialGauge>

 

Niko
Telerik team
 answered on 01 May 2013
0 answers
328 views
I'm not sure if this is a bug or if this is the way it's supposed to be, but if you set the selected index, then change the selected value of a combobox, the combobox does not select that value, but instead changes the value of the currently selected index. I would think changing the selected value would have the combobox select the item with that value instead of changing the value of the currently selected item. I can also see how it might go the other way so you can change the value of the selected item, but it seems more useful if the combobox actually selected the value you set in selected value. Or did i just do something wrong?

I guess here's my specific question, I have two radcombobox's. when the page loads, i first set the selected index to 0, then check to see if i need to select a specific item in the lists. if i do, i set the selected value of the radcombobox's to the value of that item. however, every time in the codebehind when i try to get the value of the selected item, it always gives me the value of the item at 0 (unless i set the selected value, which it will give me that value instead, even if i haven't changed the selected item).

anyway, if that makes any sense, i actually fixed the problem by not setting the selected index at all (since i was setting it to 0 anyway).

update: nope, there's still a problem. setting the selected value does not show as the selected item in the combobox, although i am now getting the correct selected value in the code behind, when i refresh the window, the "selected item" is the first item in the list. but if i pull down, it shows the correct selected item highlighted

update 2: sorry, the problem was because EnableLoadOnDemand was set to true, now it works fine (stupid... i've been trying to figure this out the last day and a half, and now that i decide to register to this site to post this problem, i fix it before i even get a response, haha)
Iedoc
Top achievements
Rank 1
 asked on 01 May 2013
6 answers
236 views
Hello,

I am quiet confused with saving the dock state in cookie. I just need the C# code to save the dock state in the cookie and I want it to be persisted for a particular time duration.

Please help with code,
JC.
Dobromir
Telerik team
 answered on 01 May 2013
1 answer
123 views
My problem is on the design of radAlert

See the picture attached please.

As you can see there are another two extra buttons behind the normal ones, does someone knows why is this happening? please.

The radAlert from the picture happens when I click a buttonColumn from a RadGrid, see the code.

<telerik:GridButtonColumn ConfirmText="¿Eliminar registro?" ConfirmDialogType="RadWindow" ConfirmTitle="Eliminar"
                ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="140px" ConfirmDialogWidth="250px"  ItemStyle-HorizontalAlign="Center" />

Thanks
Bozhidar
Telerik team
 answered on 01 May 2013
3 answers
161 views
We have two RadGrids sitting side by side in a table, with a RadFilter for each. The RadFilters start out invisible, and are shown by a button on the RadToolbar inside the command templates of their respective grids.  The two grids have set widths, which allow them to fit side by side on the screen. However, when you display the RadFilter, it creates extra width on both sides of the RadToolbar/command template of the associated RadGrid, pushing them out of position. Any ideas why or what to do about it?

The two grids appear on the second RadPageView of a RadMultiePage control.

The relevant code:

<table cellpadding="0" cellspacing="0" border="0" width="990">
        <tr>
            <td class="legendcolor" style="width: 450; text-align: center">
                Activity Codes
            </td>
            <td class="legendcolor" style="width: 450; text-align: center">
                Pay Groups
            </td>
        </tr>
        <tr>
            <td valign="top" style="width: 450; text-align: center">
                <telerik:RadFilter Width="450" runat="server" ID="RadFilter2" Visible="false" FilterContainerID="RadGridActivity"
            EnableEmbeddedSkins="true" ShowApplyButton="false" />
            <telerik:RadGrid ID="RadGridActivity" runat="server" OnItemCommand="RadGridActivity_ItemCommand" OnItemDataBound="RadGridActivity_ItemDataBound" OnItemCreated="RadGridActivity_ItemCreated" OnUpdateCommand="RadGridActivity_UpdateCommand"
            AutoGenerateColumns="False" PageSize="15" AllowPaging="True" AllowSorting="True" OnExcelExportCellFormatting="RadGridActivity_ExcelExportCellFormatting" OnInsertCommand="RadGridActivity_InsertCommand"
            CellSpacing="0" DataSourceID="ldsActivityCodes" GridLines="None" AllowFilteringByColumn="true" OnCSVExportCellFormatting="RadGridActivity_CSVExportCellFormatting" OnDeleteCommand="RadGridActivity_DeleteCommand">
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
            <MasterTableView DataKeyNames="ID" DataSourceID="ldsActivityCodes" TableLayout="Fixed" IsFilterItemExpanded="false" CommandItemDisplay="Top" OverrideDataSourceControlSorting="true">
                <CommandItemTemplate>
                    <telerik:RadToolBar runat="server" ID="RadToolBar2" Height="24px" EnableEmbeddedSkins="true" OnButtonClick="RadToolBar2_ButtonClick" EnableRoundedCorners="true">
                        <Items>
                            <telerik:RadToolBarButton Text="Show filter" CommandName="OpenRadFilter" />
                            <telerik:RadToolBarButton Text="Apply filter" CommandName="FilterRadGrid" />
                            <telerik:RadToolBarButton Text="Clear Filter" CommandName="ClearFilter" />
                            <telerik:RadToolBarButton Text="Hide filter" CommandName="CloseRadFilter" />
                            <telerik:RadToolBarButton Width="40px" Text="" CommandName="" />
                            <telerik:RadToolBarButton Text="" CommandName="">
                                <ItemTemplate>
                                    <telerik:RadButton ID="ExcelExportButton2" runat="server" Image-EnableImageButton="true" Image-ImageUrl="images/Export2Excel.gif" ToolTip="Export to Excel this page. Click Yes at MS 'different format' error message." Width="44px" Height="22px" CommandName="ExportToExcel" />
                                    <telerik:RadButton ID="RadButton2" runat="server" Width="1px" Height="1px" />
                                    <telerik:RadButton ID="CSVExportButton2" runat="server" Image-EnableImageButton="true" Image-ImageUrl="images/Export2CSV.gif" ToolTip="Export to CSV this page" Width="44px" Height="22px" CommandName="ExportToCSV" />
                                    <telerik:RadButton ID="RadButton5" runat="server" Width="1px" Height="1px" />
                                    <telerik:RadButton ID="AddButton" runat="server" Image-EnableImageButton="true" Image-ImageUrl="images/2Add.gif" ToolTip="Add New Employee" Width="44px" Height="22px" CommandName="InitInsert" />
                                </ItemTemplate>
                            </telerik:RadToolBarButton>
                        </Items>
                    </telerik:RadToolBar>
                </CommandItemTemplate>
                <Columns>
                    <telerik:GridBoundColumn DataField="FullName" FilterControlAltText="Filter FullName column"
                        HeaderText="FullName" Visible="false" SortExpression="FullName" AllowFiltering="false" UniqueName="FullName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column"
                        HeaderText="ID" Visible="false" SortExpression="ID" AllowFiltering="false" UniqueName="ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Code" DataType="System.Int32" FilterControlAltText="Filter Code column"
                        HeaderText="Activity Code" ReadOnly="true" SortExpression="Code" UniqueName="Code">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Wrap="False" />
                        <ItemStyle HorizontalAlign="Center" Wrap="False" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column"
                        HeaderText="Description" ReadOnly="true" SortExpression="Description" UniqueName="Description">
                        <HeaderStyle HorizontalAlign="Center" Width="200" VerticalAlign="Top" Wrap="False" />
                        <ItemStyle HorizontalAlign="Center" Width="200" Wrap="False" />
                    </telerik:GridBoundColumn>
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderText="Edit" ButtonType="ImageButton" />
                    <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" HeaderText="Delete" CommandName="Delete" ButtonType="ImageButton" />
                </Columns>
                <EditFormSettings EditFormType="Template">
                    <FormTemplate>
                        <table>
                            <tr>
                                <td class="gtempname">
                                    Activity Code #:
                                </td>
                                <td align="left">
                                       <telerik:RadNumericTextBox ID="txtActivityCode" runat="server" Width="30px" CssClass="gtextbox" Type="Number" NumberFormat-DecimalDigits="0" DbValue='<%# Bind("Code") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="gtempname">
                                    Description:
                                </td>
                                <td align="left">
                                       <asp:TextBox Width="150px" ID="txtACDescription" runat="server" CssClass="gtextbox" Text='<%# Bind("Description") %>'></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <center>
                                        <asp:Button ID="btnUpdate" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                            CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                        </asp:Button>  
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="false"
                                            CommandName="Cancel"></asp:Button></center>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>
                 </td>
            <td valign="top" style="width: 450; text-align: center">
                <telerik:RadFilter Width="450" runat="server" ID="RadFilter3" Visible="false" FilterContainerID="RadGridPayGroups"
            EnableEmbeddedSkins="true" ShowApplyButton="false" />
        <telerik:RadGrid ID="RadGridPayGroups" runat="server" OnExcelExportCellFormatting="RadGridPayGroups_ExcelExportCellFormatting" OnItemCreated="RadGridPayGroups_ItemCreated" OnDeleteCommand="RadGridPayGroups_DeleteCommand"
            AutoGenerateColumns="False" PageSize="15" AllowPaging="True" AllowSorting="True" OnItemCommand="RadGridPayGroups_ItemCommand" OnItemDataBound="RadGridPayGroups_ItemDataBound" OnUpdateCommand="RadGridPayGroups_UpdateCommand"
            CellSpacing="0" DataSourceID="ldsPayGroups" GridLines="None" AllowFilteringByColumn="true" OnCSVExportCellFormatting="RadGridPayGroups_CSVExportCellFormatting" OnInsertCommand="RadGridPayGroups_InsertCommand">
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
            <MasterTableView DataKeyNames="ID" DataSourceID="ldsPayGroups" TableLayout="Fixed" IsFilterItemExpanded="false" CommandItemDisplay="Top" OverrideDataSourceControlSorting="true">
                <CommandItemSettings ExportToPdfText="Export to PDF" />
                <CommandItemTemplate>
                    <telerik:RadToolBar runat="server" ID="RadToolBar3" Height="24px" EnableEmbeddedSkins="true" OnButtonClick="RadToolBar3_ButtonClick" EnableRoundedCorners="true">
                        <Items>
                            <telerik:RadToolBarButton Text="Show filter" CommandName="OpenRadFilter" />
                            <telerik:RadToolBarButton Text="Apply filter" CommandName="FilterRadGrid" />
                            <telerik:RadToolBarButton Text="Clear Filter" CommandName="ClearFilter" />
                            <telerik:RadToolBarButton Text="Hide filter" CommandName="CloseRadFilter" />
                            <telerik:RadToolBarButton Width="40px" Text="" CommandName="" />
                            <telerik:RadToolBarButton Text="" CommandName="">
                                <ItemTemplate>
                                    <telerik:RadButton ID="ExcelExportButton3" runat="server" Image-EnableImageButton="true" Image-ImageUrl="images/Export2Excel.gif" ToolTip="Export to Excel this page. Click Yes at MS 'different format' error message." Width="44px" Height="22px" CommandName="ExportToExcel" />
                                    <telerik:RadButton ID="RadButton3" runat="server" Width="1px" Height="1px" />
                                    <telerik:RadButton ID="CSVExportButton3" runat="server" Image-EnableImageButton="true" Image-ImageUrl="images/Export2CSV.gif" ToolTip="Export to CSV this page" Width="44px" Height="22px" CommandName="ExportToCSV" />
                                    <telerik:RadButton ID="RadButton4" runat="server" Width="1px" Height="1px" />
                                    <telerik:RadButton ID="AddButton" runat="server" Image-EnableImageButton="true" Image-ImageUrl="images/2Add.gif" ToolTip="Add New Employee" Width="44px" Height="22px" CommandName="InitInsert" />
                                </ItemTemplate>
                            </telerik:RadToolBarButton>
                        </Items>
                    </telerik:RadToolBar>
                </CommandItemTemplate>
                <Columns>
                    <telerik:GridBoundColumn DataField="FullName" FilterControlAltText="Filter FullName column" FilterControlWidth="1"
                        HeaderText="FullName" Visible="false" AllowFiltering="false" SortExpression="FullName" UniqueName="FullName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column" FilterControlWidth="1"
                        HeaderText="ID" Visible="false" AllowFiltering="false" SortExpression="ID" UniqueName="ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="PayGroupCode" DataType="System.Int32" FilterControlAltText="Filter PayGroupCode column"
                        HeaderText="PayGroupCode" ReadOnly="True" SortExpression="PayGroupCode" UniqueName="PayGroupCode" FilterControlWidth="100">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Wrap="False" />
                        <ItemStyle HorizontalAlign="Center" Wrap="False" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column" FilterControlWidth="200"
                        HeaderText="Description" ReadOnly="true" SortExpression="Description" UniqueName="Description">
                        <HeaderStyle HorizontalAlign="Center" Width="200" VerticalAlign="Top" Wrap="False" />
                        <ItemStyle HorizontalAlign="Center" Width="200" Wrap="False" />
                    </telerik:GridBoundColumn>
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderText="Edit" ButtonType="ImageButton" FilterControlWidth="75" />
                    <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" HeaderText="Delete" CommandName="Delete" ButtonType="ImageButton" FilterControlWidth="75" />
                </Columns>
                <EditFormSettings EditFormType="Template">
                    <FormTemplate>
                        <table>
                            <tr>
                                <td class="gtempname">
                                    PayGroupCode #:
                                </td>
                                <td align="left">
                                       <telerik:RadNumericTextBox ID="txtPayGroupCode" runat="server" Width="30px" CssClass="gtextbox" Type="Number" NumberFormat-DecimalDigits="0" DbValue='<%# Bind("PayGroupCode") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="gtempname">
                                    Description:
                                </td>
                                <td align="left">
                                       <asp:TextBox Width="150px" ID="txtPGDescription" runat="server" CssClass="gtextbox" Text='<%# Bind("Description") %>'></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <center>
                                        <asp:Button ID="btnUpdate" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                            CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                        </asp:Button>  
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="false"
                                            CommandName="Cancel"></asp:Button></center>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>
            </td>
        </tr>
    </table><br />
HISEagle
Top achievements
Rank 1
 answered on 01 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?