Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
370 views

Hi all,

My scenario is as follows. Instead of deleting a record, I would like to Update two fields. The first is "UpdatedBy", which holds a value representing the deleting user. The second is "Deleted", the flag I use to ascertain whether a record has been removed from the system. I would like to do this with a custom DeleteCommand in my SqlDataSource. I have it successfully working in 1 RadGrid, but in another I am getting errors that I need to declare my @Scalar variables. All parameters I use I have declared, but for some reason it just wont recognize them.

This is my working RadGrid:

01.<asp:SqlDataSource ID="StaffSitesDataSource" runat="server" ConnectionString='<%$ ConnectionStrings:MainConnection %>' DeleteCommand=" UPDATE [SitesStaff] SET [UpdatedBy] = @UpdatedBy WHERE [SitesStaffId] = @SitesStaffId; DELETE FROM [SitesStaff] WHERE [SitesStaffId] = @SitesStaffId" InsertCommand="INSERT INTO [SitesStaff] ([SiteId], [StaffId], [UpdatedBy]) VALUES (@SiteId, @StaffId, @UpdatedBy)" SelectCommand="SELECT t0.SitesStaffId, t1.SiteName FROM [SitesStaff] t0 INNER JOIN Sites t1 ON t0.SiteId = t1.SiteId WHERE ([StaffId] = @StaffId)">
02.                            <SelectParameters>
03.                                <asp:ControlParameter ControlID="hdnFldSelectedStaffId" PropertyName="Value" Name="StaffId" Type="Int32"></asp:ControlParameter>
04.                            </SelectParameters>
05.                            <DeleteParameters>
06.                                <asp:Parameter Name="SitesStaffId" Type="Int32"></asp:Parameter>
07.                                <asp:Parameter Name="UpdatedBy" Type="String"></asp:Parameter>
08.                            </DeleteParameters>
09.                            <InsertParameters>
10.                                <asp:Parameter Name="SiteId" Type="Int32"></asp:Parameter>
11.                                <asp:ControlParameter ControlID="hdnFldSelectedStaffId" PropertyName="Value" Name="StaffId" Type="Int32"></asp:ControlParameter>
12.                                <asp:Parameter Name="UpdatedBy" Type="String"></asp:Parameter>
13.                            </InsertParameters>
14.                        </asp:SqlDataSource>
15. 
16.                        <telerik:RadGrid ID="rgStaffSites" runat="server" AllowSorting="True" Skin="Windows7" Font-Size="9pt" AutoGenerateDeleteColumn="true" DataSourceID="StaffSitesDataSource" AllowMultiRowSelection="true" OnInsertCommand="rgStaffSites_InsertCommand">
17.                            <MasterTableView AutoGenerateColumns="False" DataSourceID="StaffSitesDataSource" DataKeyNames="SitesStaffId" AllowAutomaticDeletes="true" AllowAutomaticUpdates="false" AllowAutomaticInserts="false" EditMode="PopUp" CommandItemDisplay="Top">
18.                                <CommandItemTemplate>
19.                                    <telerik:RadToolBar RenderMode="Lightweight" ID="rtbRgStaffSites" runat="server" Skin="Windows7" AutoPostBack="true">
20.                                        <Items>
21.                                            <telerik:RadToolBarButton Text="Add new" CommandName="InitInsert" ImageUrl="~/Images/AddRecord.gif" Visible='<%# Not rgStaffSites.MasterTableView.IsItemInserted %>'></telerik:RadToolBarButton>
22.                                            <telerik:RadToolBarButton Text="Delete selected Sites" CommandName="DeleteSelected" ImageUrl="~/Images/Delete.gif"></telerik:RadToolBarButton>
23.                                            <telerik:RadToolBarButton Text="Refresh Sites" CommandName="RebindGrid" ImageUrl="~/Images/Refresh.gif"></telerik:RadToolBarButton>
24.                                            <telerik:RadToolBarButton Value="UserName" OuterCssClass="rightButton">
25.                                                <ItemTemplate>
26.                                                    <asp:Label ID="lblSelectedUserName2" runat="server"></asp:Label>
27.                                                </ItemTemplate>
28.                                            </telerik:RadToolBarButton>
29.                                        </Items>
30.                                    </telerik:RadToolBar>
31.                                </CommandItemTemplate>
32.                                <EditFormSettings InsertCaption="Add Site">
33.                                    <PopUpSettings CloseButtonToolTip="Cancel Add" Modal="false" OverflowPosition="Center" />
34.                                    <EditColumn ButtonType="ImageButton"></EditColumn>
35.                                </EditFormSettings>
36.                                <Columns>
37.                                    <telerik:GridClientSelectColumn UniqueName="SelectColumn" ItemStyle-Width="25px" HeaderStyle-Width="25px"></telerik:GridClientSelectColumn>
38.                                    <telerik:GridBoundColumn DataField="SitesStaffId" ReadOnly="True" Display="false" Visible="true" HeaderText="SitesStaffId" SortExpression="SitesStaffId" UniqueName="SitesStaffId" DataType="System.Int32" FilterControlAltText="Filter SitesStaffId column"></telerik:GridBoundColumn>
39.                                    <telerik:GridTemplateColumn HeaderText="Site" UniqueName="SiteName" DataField="SiteName" FilterControlAltText="Filter SiteName column" ItemStyle-HorizontalAlign="Left">
40.                                        <ItemTemplate>
41.                                            <%# Eval("SiteName") %>
42.                                        </ItemTemplate>
43.                                        <EditItemTemplate>
44.                                            <telerik:RadComboBox ID="rgStaffSites_rcbSites" runat="server" DataSourceID="SitesDataSource" DataTextField="SiteName" DataValueField="SiteId" Skin="Windows7" CheckBoxes="true"></telerik:RadComboBox>
45.                                        </EditItemTemplate>
46.                                    </telerik:GridTemplateColumn>
47.                                </Columns>
48.                            </MasterTableView>
49.                            <ClientSettings>
50.                                <ClientEvents OnPopUpShowing="PopUpShowing" />
51.                                <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" />
52.                            </ClientSettings>
53.                        </telerik:RadGrid>

 

This is the RadGrid I cant get to work:

01.<asp:SqlDataSource ID="TasksCollaboratorsDataSource" runat="server" ConnectionString='<%$ ConnectionStrings:MainConnection %>' DeleteCommandType="Text" DeleteCommand="UPDATE [TasksSharing] SET [UpdatedBy] = @UpdatedBy, [Deleted] = @Deleted WHERE [ShareId] = @ShareId" InsertCommand="INSERT INTO [TasksSharing] ([TaskId], [TimeShared], [SharedBy], [SharedWith], [Implementing], [Accountable], [AccessLevel], [Deleted], [UpdatedBy]) VALUES (@TaskId, @TimeShared, @SharedBy, @SharedWith, @Implementing, @Accountable, @AccessLevel, @Deleted, @UpdatedBy)" SelectCommand="SELECT * FROM [TasksSharing] WHERE ([TaskId] = @TaskId AND [Deleted] = @Deleted)" UpdateCommand="UPDATE [TasksSharing] SET [UpdatedBy] = @UpdatedBy, [Implementing] = @Implementing, [Accountable] = @Accountable, [AccessLevel] = @AccessLevel WHERE [ShareId] = @ShareId">
02.                                  <DeleteParameters>                                       
03.                                      <asp:Parameter Name="UpdatedBy" Type="String"></asp:Parameter>
04.                                       <asp:Parameter Name="Deleted" Type="Boolean" DefaultValue="True"></asp:Parameter>
05.                                      <asp:Parameter Name="ShareId" Type="Int32"></asp:Parameter>
06.                                  </DeleteParameters>
07.                                  <InsertParameters>
08.                                      <asp:Parameter Name="TaskId" Type="Int32"></asp:Parameter>
09.                                      <asp:Parameter Name="TimeShared" Type="DateTime"></asp:Parameter>
10.                                      <asp:Parameter Name="SharedBy" Type="String"></asp:Parameter>
11.                                      <asp:Parameter Name="SharedWith" Type="String"></asp:Parameter>
12.                                      <asp:Parameter Name="Implementing" Type="Boolean"></asp:Parameter>
13.                                      <asp:Parameter Name="Accountable" Type="Boolean"></asp:Parameter>
14.                                      <asp:Parameter Name="AccessLevel" Type="String"></asp:Parameter>
15.                                      <asp:Parameter Name="UpdatedBy" Type="String"></asp:Parameter>
16.                                      <asp:Parameter Name="Deleted" Type="Boolean" DefaultValue="True"></asp:Parameter>
17.                                  </InsertParameters>
18.                                  <SelectParameters>
19.                                      <asp:ControlParameter Name="TaskID" ControlID="hdnFldSelectedTaskID" Type="Int32" DefaultValue="0" ConvertEmptyStringToNull="true"></asp:ControlParameter>
20.                                      <asp:Parameter Name="Deleted" Type="Boolean" DefaultValue="False"></asp:Parameter>
21.                                  </SelectParameters>
22.                                  <UpdateParameters>
23.                                      <asp:Parameter Name="Implementing" Type="Boolean"></asp:Parameter>
24.                                      <asp:Parameter Name="Accountable" Type="Boolean"></asp:Parameter>
25.                                      <asp:Parameter Name="AccessLevel" Type="String"></asp:Parameter>
26.                                      <asp:Parameter Name="ShareId" Type="Int32"></asp:Parameter>
27.                                      <asp:Parameter Name="UpdatedBy" Type="String"></asp:Parameter>
28.                                  </UpdateParameters>
29.                              </asp:SqlDataSource>
30. 
31. 
32.                              <telerik:RadGrid ID="rgTasksCollaborators" runat="server" DataSourceID="TasksCollaboratorsDataSource" AllowSorting="True" AllowFilteringByColumn="True" Skin="Windows7"
33.                                  AllowAutomaticDeletes="true" AllowAutomaticInserts="false" AllowAutomaticUpdates="false" AllowMultiRowSelection="true" AutoGenerateDeleteColumn="true" OnItemCommand="rgCollaborators_ItemCommand">
34.                                  <ClientSettings>
35.                                      <Selecting AllowRowSelect="True" EnableDragToSelectRows="true"></Selecting>
36.                                  </ClientSettings>
37.                                  <MasterTableView DataSourceID="TasksCollaboratorsDataSource" AutoGenerateColumns="False" DataKeyNames="ShareId" CommandItemDisplay="Top">
38.                                      <CommandItemTemplate>
39.                                          <telerik:RadToolBar ID="rtbTasksCollaborators" RenderMode="Lightweight" runat="server" Skin="Windows7" AutoPostBack="true">
40.                                              <Items>
41.                                                  <telerik:RadToolBarButton Text="Add Collaborator" CommandName="InitInsert" ImageUrl="~/Images/AddRecord.gif"></telerik:RadToolBarButton>
42.                                                  <telerik:RadToolBarButton Text="Remove Selected Collaborators" CommandName="DeleteSelected" ImageUrl="~/Images/Delete.gif"></telerik:RadToolBarButton>
43.                                                  <telerik:RadToolBarButton Text="Refresh Colaborators" CommandName="RebindGrid" ImageUrl="~/Images/Refresh.gif" OuterCssClass="rightButton"></telerik:RadToolBarButton>
44.                                              </Items>
45.                                          </telerik:RadToolBar>
46.                                      </CommandItemTemplate>
47.                                      <ItemStyle CssClass="defaultRadGridItem" />
48.                                      <AlternatingItemStyle CssClass="defaultRadGridItem" />
49.                                      <EditFormSettings>
50.                                          <EditColumn ButtonType="ImageButton"></EditColumn>
51.                                          <PopUpSettings Width="600px" CloseButtonToolTip="Cancel" />
52.                                          <FormTemplate>
53.                                          </FormTemplate>
54.                                      </EditFormSettings>
55.                                      <Columns>
56.                                          <telerik:GridClientSelectColumn UniqueName="selectColumn"></telerik:GridClientSelectColumn>
57.                                          <telerik:GridEditCommandColumn UniqueName="editColumn"></telerik:GridEditCommandColumn>
58.                                          <telerik:GridBoundColumn DataField="ShareId" ReadOnly="True" Display="false" HeaderText="ShareId" SortExpression="ShareId" UniqueName="ShareId" DataType="System.Int32" FilterControlAltText="Filter ShareId column"></telerik:GridBoundColumn>
59.                                          <telerik:GridBoundColumn DataField="TaskId" Display="false" HeaderText="TaskId" SortExpression="TaskId" UniqueName="TaskId" DataType="System.Int32" FilterControlAltText="Filter TaskId column"></telerik:GridBoundColumn>
60.                                          <telerik:GridDateTimeColumn DataField="TimeShared" HeaderText="Time Shared" SortExpression="TimeShared" UniqueName="TimeShared" DataType="System.DateTime" FilterControlAltText="Filter TimeShared column"></telerik:GridDateTimeColumn>
61.                                          <telerik:GridBoundColumn DataField="SharedBy" HeaderText="Shared By" SortExpression="SharedBy" UniqueName="SharedBy" FilterControlAltText="Filter SharedBy column"></telerik:GridBoundColumn>
62.                                          <telerik:GridBoundColumn DataField="SharedWith" HeaderText="Shared With" SortExpression="SharedWith" UniqueName="SharedWith" FilterControlAltText="Filter SharedWith column"></telerik:GridBoundColumn>
63.                                          <telerik:GridCheckBoxColumn DataField="Implementing" HeaderText="Implementing" SortExpression="Implementing" UniqueName="Implementing" DataType="System.Boolean" FilterControlAltText="Filter Implementing column"></telerik:GridCheckBoxColumn>
64.                                          <telerik:GridCheckBoxColumn DataField="Accountable" HeaderText="Accountable" SortExpression="Accountable" UniqueName="Accountable" DataType="System.Boolean" FilterControlAltText="Filter Accountable column"></telerik:GridCheckBoxColumn>
65.                                          <telerik:GridDropDownColumn DataField="AccessLevel" HeaderText="Access Level" SortExpression="AccessLevel" UniqueName="AccessLevel" FilterControlAltText="Filter AccessLevel column" DataSourceID="AccessLevelsDatasource" ListTextField="ItemValue" ListValueField="ItemId"></telerik:GridDropDownColumn>
66.                                          <telerik:GridCheckBoxColumn DataField="Deleted" Display="false" HeaderText="Deleted" SortExpression="Deleted" UniqueName="Deleted" DataType="System.Boolean" FilterControlAltText="Filter Deleted column"></telerik:GridCheckBoxColumn>
67.                                          <telerik:GridBoundColumn DataField="UpdatedBy" Display="false" HeaderText="UpdatedBy" SortExpression="UpdatedBy" UniqueName="UpdatedBy" FilterControlAltText="Filter UpdatedBy column"></telerik:GridBoundColumn>
68.                                      </Columns>
69.                                  </MasterTableView>
70.                              </telerik:RadGrid>

 

I feel like it is something obvious that I am not seeing. Any help would be greatly appreciated.

Thanks,

Mike

Eyup
Telerik team
 answered on 11 Apr 2017
1 answer
63 views

So I've been trying to use these tools for a few hours and they seem really cool, but I feel like I'm doing something wrong. 

Basically I put a radpagelayout control onto the page I'm working on, then I put 3 rows in it and two columns in each row. In the code I can see that and using the <Content> tags I can put stuff in the columns or I can drag a control in between <Content> and </Content> and have it show up that way. On the design tab though the pagelayout appears as just a square and I can't drag say a button into it and have it be in the pagelayout's grid. The only way to make the layout not be a little square in the corner is the put something into the code manually, and even then I cant drag other controls onto it. How do I do it, what am I doing wrong?

 

TL;DR RadPageLayout appears as a small square on design tab and I can't put controls onto it even when I make rows/columns in the properties. Not sure what I'm doing wrong.

Rumen
Telerik team
 answered on 11 Apr 2017
2 answers
102 views

I have a scheduler setup where the datasource select command also has a control parameter being passed in from a combo box. The generated execute_sql statement does not seem to work and sql server complains about parameter not being passed in. I have tried executing the generated statement manually in sql server and the result is the same. The code is bellow:

 

SelectCommand="EXEC Scheduler.GetAppointments" 

 <SelectParameters>
            <asp:ControlParameter ControlID="cmbProviderSort" DbType="Int32" ConvertEmptyStringToNull="true" DefaultValue="-1" 
                PropertyName="SelectedValue" Name="a" />
        </SelectParameters>

 

The generated statement from this is : exec sp_executesql N'EXEC Scheduler.GetAppointments',N'@a int',@a=26

If i try and execute that statement on sql server it complains the @a parameter is not being passed.

Thanks

Eyup
Telerik team
 answered on 11 Apr 2017
1 answer
139 views

Hi I am new to telerik i do my project by using telerik controls. I want to build entry form in batch edit mode but i cant to bind data from the database for cascading combo boxes in batch edit mode. Please help me

I have three types of columns insurance plan,insurance type, insurance policy but i cant the data from <itemtemplate event> </itemtemplate>   

 

Vasil
Telerik team
 answered on 11 Apr 2017
2 answers
99 views

HI,

I have been using the Rotator with transparent PNGs. I had to set the RenderMode for the Rotator to 'Classic' for the transparency to work, however with Q1 2017 this does not work and the images all have a white background now.

Please help

Jon.

 

Rumen
Telerik team
 answered on 10 Apr 2017
1 answer
132 views

I am using my own pop-up dialog window for adding/editing tasks in the Gantt display.  Saving from this dialog causes a postback to the server and a redraw of the gantt chart.  I need to programmatically re-select the last task added/edited  (either server side or client side but preferably server side).

Is there anyway to achieve this?

Thanks.

Colin
Top achievements
Rank 1
 answered on 10 Apr 2017
3 answers
494 views

I'm new to the Telerik suite and this control is my first real exposure.  I hope the other controls are better implemented than this one.

I have just spent 3 days getting tasks to appear with different background colours.  Am I missing something?  I can't believe the hoops I've had to jump through to achieve this (custom task objects, custom task factories, custom task providers, client templates and I still had to finish it off with a jquery hack!).  Surely the basic appearance of a task item on the chart should be as simple as setting a few properties server side e.g. "task.BackColor=..." etc?

No basic formatting, no basic client-side events such as chart_onload, item_selected, item_double_click.

The documentation is less than helpful and all the examples I've looked at seem to assume I'm using windows entity framework (I'm not.)

Are there plans to make this chart more customisable in a future release?

If anyone found a more straightforward way to achieve this basic functionality I would be extremely grateful if they could share what they did.

Colin
Top achievements
Rank 1
 answered on 10 Apr 2017
2 answers
242 views

I have a GridTemplateColumn that is defined as with a DateTime", but actually contains a link button. The value in the column is a date, but since the ItemTemplate is defined as a link button the actual filter value is a string. When you search if you enter a valid date value it will filter correctly, but if you enter a 2, for example, the SQL gets an error because you obviously can't compare 2 to a date field.

What I want to do is before the filter is performed validate that it is a valid date, if not just remove the filter. Additionally, I would really like to be able to add the date selector box next to the filter field. That would help in getting the date in the correct format.

Below is the definition for the column:

<telerik:GridTemplateColumn UniqueName="CREATEDON" DataField="CREATEDON" SortExpression="CREATEDON" HeaderText="Date Created" DataType="System.DateTime"
    CurrentFilterFunction="GreaterThanOrEqualTo" AutoPostBackOnFilter="true" HeaderStyle-Width="100">
    <ItemTemplate>
        <asp:LinkButton ID="lnkCreatedOn" runat="server" CommandName="VIEWTASK" CommandArgument='<%# Eval("TaskId") %>' OnClick="lnkCreatedOn_Click" />
    </ItemTemplate>
</telerik:GridTemplateColumn>

 

Thanks in advance.

Rodney

 

Rodney
Top achievements
Rank 2
 answered on 10 Apr 2017
1 answer
430 views

I have an image inside of a RadToolTip. While everything is functional, the ToolTip displays, and all of the content, I cannot add AlternateText to the image.

It is an asp:Image control:

<telerik:RadToolTip ID="RadToolTip1" runat="server" RelativeTo="Element" TargetControlID="myImage" Skin="Default" EnableShadow="true" Position="BottomRight" AutoCloseDelay="1000" Sticky="true" IgnoreAltAttribute="true">
    <h2>An image with alt text</h2>
    <asp:Image ID="Image1" runat="server" ImageUrl="~/Path/To/Image.jpg" AlternateText="Here is description of the image" />
</telerik:RadToolTip>

 

I am aware of the IgnoreAltAttribute property but this only refers to the image clicked to open the ToolTip, not images inside of the ToolTip.

How can I prevent alt text from being removed from the contents of the ToolTip?

Any help is appreciated.

Marin Bratanov
Telerik team
 answered on 10 Apr 2017
1 answer
61 views

Hi, i have encounter some CSS issue with the Image manager and Document Manager dialog. and i cant seems to find the CSS causing this. i have customised the dialog aspx file for some customization but dont's seems to have any css inside it

 

 

Benjamin
Top achievements
Rank 1
 answered on 10 Apr 2017
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?