Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
272 views
Hello,

I have a RadGrid that I'm attempting to use in form editing on. I'm currently using the following GridTemplateColumn. The problem is that what I really need is an InsertItemTemplate like what asp:DetailsView has. This is because I want the Status field to be editable in a RadComboBox on insert, but, non-editable and displayed in a label on edit. Does anyone know if this is possible in RadGrid? I'm assuming that I'll probably have to handle an event and adjust the visibility of fields based on whether it's in insert or edit mode? The problem is that I don't know what event I should use to do this and I also don't know how to lookup the control. I'm assuming I'll probably have to use FindControl() and maybe use the RowIndex to find the proper row in the grid or something. Any help would be greatly appreciated.

 

 

<telerik:GridTemplateColumn HeaderText="Status" SortExpression="Status">

 

 

 

<EditItemTemplate>

 

 

 

<telerik:RadComboBox ID="StatusRadComboBox" runat="server" SelectedValue='<%# Bind("Status") %>'>

 

 

 

<Items>

 

 

 

<telerik:RadComboBoxItem Text="" Value=""></telerik:RadComboBoxItem>

 

 

 

<telerik:RadComboBoxItem Text="Assigned" Value="Assigned"></telerik:RadComboBoxItem>

 

 

 

<telerik:RadComboBoxItem Text="Lost" Value="Lost"></telerik:RadComboBoxItem>

 

 

 

<telerik:RadComboBoxItem Text="Returned" Value="Returned"></telerik:RadComboBoxItem>

 

 

 

</Items>

 

 

 

</telerik:RadComboBox>

 

 

 

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Value is required"

 

 

 

ControlToValidate="StatusRadComboBox"></asp:RequiredFieldValidator>

 

 

 

</EditItemTemplate>

 

 

 

<ItemTemplate>

 

 

 

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

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 




Jon
Marin
Telerik team
 answered on 23 Sep 2010
1 answer
113 views
Hi,

I am using the Radgrid's client-Events -> Oncommand  handler to add some validations  to a button before it is submitted, it works fine and was able to cancel the event when a criteria is not met, but for some buttons like the "Delete" button where I didnt add any validations,  the itemindex that is passed on my server side  OnItemCommand  event handler is always zero. Is this supposed to be the case? How do I pass the itemindex argument?  I tried to do a firecommand (args.get_commandName(), args.get_commandargment()) but it returns an out of memory exception. Please see below code that I have for the raisecommand


function raisecommand(sender,args){
if (args.get_commandName=="ViewDetails"){
<<some validations here>>
args.set_cancel(true);
        }

}


Thanks
Princy
Top achievements
Rank 2
 answered on 23 Sep 2010
1 answer
104 views
I'm using a RadGrid with a LinqDataSource, there is a money DataBase column, in the Grid, it is a GridNumericColumn, with NumericType="Currency".

When I try to filter values with commas, the commas (decimal separator) are simply ignored, and after the post, the value appears in the filter as the comma didnt existed.

I've implemented the ItemCommand event, and got the RadNumericTextBox, it's Value, and Text is shown already wrong, so I tried to divide it by 100, to correct the value, in this case, nothing is done, and the filter stop working.

My Culture-Info is pt-BR. I have changed it to en-US, and it works ok (for dots, as decimal separators), also my workaround in the ItemCommand works for en culture...

Is it a known issue? What can I do to get around this behavior?

Thanks in advance, and congratulations for the great work!

Fernando Mondego
Daniel
Telerik team
 answered on 23 Sep 2010
4 answers
200 views
Hi All. Sorry if this has been answered previously but i couldn't find any related posts.

I am trying to design a grid with the "Add a New Record" option in the header and footer (CommandItemDisplay="TopAndBottom")  for an InPlace insert. It works great if i put a command column in the grid. However I would like to only show the insert and cancel commands in the row that is to be inserted. The MasterTableView has the "AllowAutomaticInserts="true" property set, none of the other automatic properties are set. I do not want an edit option on all the other existing rows in the grid. Can someone point me in the right direction to accomplish this?

Thanks for your help.
Scott
Pavlina
Telerik team
 answered on 23 Sep 2010
2 answers
123 views
Hi
I am using the same method for binding data returned from json to the client side.
Please note that i am using this Grid in asp.net MVC 1.0. Script Manager and all other telerik objects are loading properly and i am receiving this JSON from a method which returns JSON. I hope that the given code is sufficient, however i can provide you MVC code, if required:
I am using the following code:

$.ajax({
            type: "POST",
            url: getAppPath() + "Account.aspx/UsersList",
            data: { State: StateVal, County: CountyVal, District: DistrictVal, School: SchoolVal, sUserName: userName, sUserEmail: email, Status: StatusVal },
            success: function(results) {
                //alert(results);
                updateGrid(results);
            },
            error: function(msg) {
                alert("The following error occurred: " + msg.status + ": " + msg.statusText);
            }

        });

 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

        <script type="text/javascript">
           

            function updateGrid(result) {
                var tableView = $find("<%= grdUsers.ClientID %>").get_masterTableView();
                tableView.set_dataSource(result);
                tableView.dataBind();
            }

            function RadGrid1_Command(sender, args) {
                
                var a = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                args.set_cancel(true);
                alert("page command");

            }


        
    
        </script>

    </telerik:RadCodeBlock>

When i call the updateGrid method
                var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
the following line returns null. However if i only use this line, it will find the Grid.
var a = $find("<%= RadGrid1.ClientID %>")
Please let me know how to handle it and later assign the json to grid in order to populate it.
Thanks.
Radoslav
Telerik team
 answered on 23 Sep 2010
2 answers
109 views
I am using RadEditor in my page to perform add and edit operations, it works like a charm in IE7 and IE8, but i am facing some problems in IE6.
when the page loads the control looks just fine but after postback on any control on the page (i.e dropdown or something) the editor control stretches.
please check the attached image just to be clear as to how the editor looks on postback and in normal view.
would be grateful if anyone could provide me with a workaround...
Senthil ramna
Top achievements
Rank 1
 answered on 23 Sep 2010
1 answer
75 views
Hi I'm new but I very intersting in the Editor http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx
I have a questio about this control.

It is possible I add a custom toolbar, maybe I need a toolbar with field become to store procedure or I need add more functionability so it is possible?

It is difficult implement this control in my web site?
Shinu
Top achievements
Rank 2
 answered on 23 Sep 2010
1 answer
105 views
Hello, i have 2 questions and they are related:
1. If you have a column that is bound to another table, and you go to edit a record, is there a way to resize the radcombobox that is provided by default?
2. If replacing the default with edititemtemplate, what is the proper way to bind that radcombobox to the current record value? setting text property doesn't work because its bound to the datasource later and overwrites your selection.

Thanks,
Viktor.
Shinu
Top achievements
Rank 2
 answered on 23 Sep 2010
2 answers
146 views
Hi,

I am using radgrid with nested detail view.
whenever user click the row, it shows detail info for particular row in the form of RadListViews.
The RadListViews are inside RadTabStrip, now when i try to Eport to PDF, it throughs exception

Telerik.Web.Apoc.ApocException: internal-destination or external-destination must be specified in basic-link


When i removed the RadTabStrip from NestedViewTemplate, i am able to export to PDF, do we need special setting if i am using RadTabStrip.

Note: telerik Version=2010.1.309.35

The code is as follows:


<NestedViewTemplate>
                        <asp:Label ID="Label1" runat="server" Style="display: none;" Text='<%#Eval("ID") %>'></asp:Label>
                        <asp:Panel ID="NestedViewPanel" runat="server" CssClass="viewWrap">
                            <div class="contactWrap">
                                <telerik:RadTabStrip  EnableViewState="true" runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="1">
                                    <Tabs>
                                        <telerik:RadTab runat="server" Text="Employee Detail" PageViewID="PageView3">
                                        </telerik:RadTab>                                 
                                     </Tabs>
                                    
                                </telerik:RadTabStrip>
                                <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="1" RenderSelectedPageOnly=  "false">
                                   
                                      <telerik:RadPageView runat="server" ID="PageView3">
                                           <div class="contactWrap">
                                                <telerik:RadListView ID="RadListView2" runat="server" DataSourceID="ObjectDataSource1"
                                                         ItemPlaceholderID="EmptyDataHolder">
                                               </telerik:RadListView>
                                          </Div>
                                      </telerik:RadPageView>

                                </telerik:RadMultiPage>
                            </div>
                        </asp:Panel>
                </NestedViewTemplate>
naimish
Top achievements
Rank 1
 answered on 23 Sep 2010
2 answers
216 views
Hi,

I try to set up a RadGrid with a delete-icon to delete a record. When the delete-button in the GridButtonColumn is from type LinkButton it works fine. But when I change it to an ImageButton to show the delete-icon, I get the following error when deleting a record:

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.


The error appears after the confirmationdialog. I tried the Classic confirmationdialog, but it didn't help.

Any ideas?

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="grdPlaylistItems">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grdPlaylistItems" LoadingPanelID="RadAjaxManagerLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <telerik:RadWindowManager ID="RadWindowManager1" Skin="Windows7" runat="server">
    </telerik:RadWindowManager>
    <asp:Label ID="lblTitlePlaylistItems" runat="server"><strong>Playlist Items</strong></asp:Label>
    <telerik:RadGrid ID="grdPlaylistItems" runat="server">
        <MasterTableView TableLayout="Fixed">
            <Columns>
                <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"
                    ButtonType="ImageButton" ImageUrl="../images/icons/remove.png" HeaderStyle-Width="30px"
                    ConfirmDialogType="RadWindow" ConfirmDialogHeight="100px" ConfirmText="Are you sure you want to delete this item?"
                    ConfirmTitle="Delete playlist item">
                </telerik:GridButtonColumn>
                <telerik:GridTemplateColumn HeaderStyle-Width="70px" HeaderText="Thumbnail">
                    <ItemTemplate>
                        <asp:Image ID="imgThumbnail" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="ItemName" HeaderText="Name" HeaderStyle-Width="200px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PlaylistItemType" HeaderText="Type" HeaderStyle-Width="70px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ItemDuration" HeaderText="Duration" HeaderStyle-Width="120px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SortOrder" HeaderText="SortOrder" UniqueName="SortOrder"
                    HeaderStyle-Width="45px" Visible="true">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    </form>
</body>
Ilona
Top achievements
Rank 1
 answered on 23 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?