Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
158 views
hi,
I just try to setup a basic scenario with RadGrid using CRUD.
So far select and delete works, but update and insert fails. I cannot see, whats going wrong.
Here is my table definition:
CREATE TABLE [dbo].[Projects] (
    [ProjectId]      INT              IDENTITY (1, 1) NOT NULL,
    [Project]        NVARCHAR (MAX)   NOT NULL,
    [OrganizationId] UNIQUEIDENTIFIER NOT NULL,
    [Created]        DATETIME         DEFAULT (getdate()) NULL,
    [Updated]        DATETIME         DEFAULT (getdate()) NULL,
    PRIMARY KEY CLUSTERED ([ProjectId] ASC)
);
The updated column has a trigger. Hope that is not the problem.
The SqlDataSource is:
<asp:SqlDataSource ID="SqlDataSourceProjects" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" DeleteCommand="DELETE FROM Projects WHERE (ProjectId = @ProjectId)" InsertCommand="INSERT INTO Projects(Project, OrganizationId) VALUES (@Project, @OrganizationId)" SelectCommand="SELECT Projects.* FROM Projects WHERE (OrganizationId = @OrganizationId)" UpdateCommand="UPDATE Projects SET Project = @Projects WHERE (OrganizationId = @OrganizationId)">
        <DeleteParameters>
            <asp:Parameter Name="ProjectId" DbType="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Project" DbType="String" />
            <asp:SessionParameter Name="OrganizationId" SessionField="OrganizationId" DbType="Guid" />
        </InsertParameters>
        <SelectParameters>
            <asp:SessionParameter Name="OrganizationId" SessionField="OrganizationId" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Projects" DbType="String" />
            <asp:SessionParameter Name="OrganizationId" SessionField="OrganizationId" DbType="Guid" />
        </UpdateParameters>
    </asp:SqlDataSource>
and the radGrid is:
<telerik:RadGrid ID="RadGridProjects" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" CellSpacing="0" Culture="de-DE" DataSourceID="SqlDataSourceProjects" GridLines="None" Skin="Metro">
<MasterTableView DataKeyNames="ProjectId" DataSourceID="SqlDataSourceProjects" CommandItemDisplay="TopAndBottom">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
        <telerik:GridBoundColumn DataField="ProjectId" DataType="System.Int32" FilterControlAltText="Filter ProjectId column" HeaderText="ProjectId" ReadOnly="True" SortExpression="ProjectId" UniqueName="ProjectId">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Project" FilterControlAltText="Filter Project column" HeaderText="Project" SortExpression="Project" UniqueName="Project">
        </telerik:GridBoundColumn>
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
    </telerik:RadGrid>
It would be really nice, if some pros can tell me, what is wrong.
Thanks in advance!
Andreas

Kostadin
Telerik team
 answered on 05 Dec 2012
3 answers
247 views
Hi,
I am using the Rad Grid available in "RadControls for ASP.NET AJAX Q3 2012" in Sharepoint 2010(vs2010/c# 3.5).
I have a visual webpart, which has 5 textbox, radgrid and a submit button.

Currently i have the items in the grid getting inserted/deleted/updated in the "oninsertcommand/ondeletecommand/onupdatecommand" events.

However, I want to do these grid changes only when the submit button is clicked. How to achieve this?
Thanks
Shinu
Top achievements
Rank 2
 answered on 05 Dec 2012
3 answers
76 views
Hi,
I am using RAD Grid in sharepoint 2010. I have added the insercommand and when i click on save in the grid, i am getting "object reference not set to instance of object error".
Below is the code i have used:
<div>
         
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
<telerik:RadGrid ID="RadGrid1" runat="server" EnableViewState="true" ShowStatusBar="true"
        ShowFooter="True" onitemcommand="RadGrid1_ItemCommand" 
        ondeletecommand="RadGrid1_DeleteCommand" 
        oninsertcommand="RadGrid1_InsertCommand" 
        onupdatecommand="RadGrid1_UpdateCommand" 
        onneeddatasource="RadGrid1_NeedDataSource" >
    <MasterTableView DataKeyNames="Title" AutoGenerateColumns="false" EditMode="InPlace" CommandItemDisplay="TopAndBottom" CommandItemSettings-AddNewRecordText="Add New Item" >
                    <Columns>
                     <telerik:GridEditCommandColumn ButtonType="ImageButton">
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="100px"
                            ConfirmDialogWidth="220px">
                        </telerik:GridButtonColumn>
  
                     <telerik:GridTemplateColumn DataField="Title" HeaderText="Product Number" UniqueName="ProductNumber"
                            Visible="true">
                            <InsertItemTemplate>
                                <telerik:RadTextBox ID="RadtxtPrdNumber" runat="server" Text='<%# Bind("Title") %>' >
                                </telerik:RadTextBox>
                            </InsertItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadTextBox ID="RadtxtPrdNumber" runat="server" Text='<%# Eval("Title") %>' >
                                </telerik:RadTextBox>
                            </EditItemTemplate>    
                            <ItemTemplate>
                            <telerik:RadTextBox ID="RadtxtPrdNumber" ReadOnly="true" runat="server" Text='<%# Eval("Title") %>' />
                            </ItemTemplate>                       
                        </telerik:GridTemplateColumn>
  
 </Columns>
      
    </MasterTableView>
     <ClientSettings EnableRowHoverStyle="true">
        </ClientSettings>
  
    </telerik:RadGrid>
  
  
<asp:Button ID="btnSubmit" runat="server" Text="Submit" 
        onclick="btnSubmit_Click" />
</div>

protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            Hashtable values = new Hashtable();
            item.ExtractValues(values);
            string ti = values["Title"].ToString();
}

In the Insercommand code, values is coming as null.
How to fix this?
Thanks
Shinu
Top achievements
Rank 2
 answered on 05 Dec 2012
1 answer
102 views
Hi,

I am hiding a number of columns, TreeListSelectColumn and TreeListButtonColumn on ItemDatabound. When the page does a postback or async postback the columns reappear?

Any suggestions much appreciated,

Regards
Ross
Radoslav
Telerik team
 answered on 05 Dec 2012
8 answers
378 views
hi

I have set AllowAutomaticInsert to True but i still don't see any insert link.

Is there any tutorial that would guide me through for a newbie? I follow the online demo and i still don't get it. I would like to have a inplace insert. Thanks
Peter
Top achievements
Rank 1
 answered on 05 Dec 2012
2 answers
118 views
Hi,

in my application, I made a custom Grid control who inherit from RadGrid.

I want every grid to have the ExportToExcel command. But I also want, in some grid, add another "custom" command.

So I create a class who implement the ITemplate interface in my custom grid control, I use this template. It works good.

But now, in some grid, I want to add a custom DropDoxnList in the Grid Command Item Display area. So I add a <CommandItemTemplate> tag in my aspx. But as I can see, this tag is override by my template.

Is it possible to mix programatic and declarative mode ?


Thanks !
Francis
Top achievements
Rank 1
 answered on 05 Dec 2012
1 answer
139 views
I have RadMenu in a RadDock and I want radmenu fit 100% width of RadDock, but it appear an horizontal scroll althought content of menu very small.
How to disappear horizontal scroll in menu?
Thanks.
http://i45.tinypic.com/o9k0i8.jpg
Code :

 <telerik:RadDockLayout runat="server" ID="RadDockLayout1">

     <telerik:RadDockZone ID="RadDockZone1" runat="server" Orientation="Vertical" Width="200px" MinHeight="400px">
     <telerik:RadDock ID="RadDock1" runat="server" Title="Blogs" EnableAnimation="true" Resizable="true" AutoPostBack="true">

         <ContentTemplate>

             <telerik:RadMenu ID="RadMenuVertical" runat="server" Width="100%" flow="Vertical" EnableShadows="true">

                 <Items>

                     <telerik:RadMenuItem Text="Books" />

                     <telerik:RadMenuItem Text="Cameras" />

                     <telerik:RadMenuItem Text="Music" />

                     <telerik:RadMenuItem Text="Software" />

                 </Items>

             </telerik:RadMenu>

         </ContentTemplate>

     </telerik:RadDock>

     </telerik:RadDockZone>

 </telerik:RadDockLayout>

Princy
Top achievements
Rank 2
 answered on 05 Dec 2012
3 answers
101 views
Hello

I add an extra menu in the menu bar of "Save the grid layout.
I have my menu that appears, but I am not able to capture the click on the item to make my own treatment.

Here is the code I add my item in the menu.
     Protected Overrides Sub OnPreRenderComplete (e As System.EventArgs)
         Sun Ace RadContextMenu menu = grdPendingRequest.HeaderContextMenu
         Sun separator As New RadMenuItem
         separator.IsSeparator = True
         menu.Items.Add (separator)

         Sun RadMenuItem item As New ()
         item.Text = "Save grid layout"
         item.NavigateUrl = ""
         item.PostBack = True
         item.Value = "Id"

         menu.Items.Add (item)

         MyBase.OnPreRenderComplete (e)
     End Sub

My version is 2010.3.1109.35

Thank you
Shinu
Top achievements
Rank 2
 answered on 05 Dec 2012
1 answer
87 views
Hello,

I am simply trying to obtain the date selected from the RadDatePicker control through javascript as I am trying to pass the value to another page as a parameter for an SQL query the page performs when loading.  However, I am having a problem with the format the date is returing.  I have tried both get_selectedDates and get_textBox with no luck in returning a date that is in a datetime format for the parameter.  With get_seletedDates I am getting a long formatted style not in the correct format while get_textBox doesn't return a date value, only that it is an HTMLelement or something along that lines.

Is there a way to get the date that is in the text box portion of the datepicker to return how it actually shows in the date picket, for instance 12/10/2012?

Thanks,
Ron
Princy
Top achievements
Rank 2
 answered on 05 Dec 2012
1 answer
61 views
Hi,

How to implement the updatecommand and deletecommand code for RAD Grid.? Is there any code samples

I have added the below code in updatecommand:
GridEditableItem editedItem = e.Item as GridEditableItem;
            DataTable ordersTable = this.GridData;
  
            //Locate the changed row in the DataSource
            DataRow[] changedRows = ordersTable.Select("Title = " + Convert.ToString(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Title"]));

In the changedRows line, i am getting error as: Cannot perform '=' operation on System.String and System.Int32.

Thanks
Shinu
Top achievements
Rank 2
 answered on 05 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?