This is a migrated thread and some comments may be shown as answers.

fill checkboxlist after editcommand

10 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mydatafactory
Top achievements
Rank 1
Mydatafactory asked on 15 Jul 2008, 08:27 AM
In my hierarchial grid I want to fill a checkboxlist which depends on two ID's. The first ID (ProjectId) is no problem, the second ID (TaskId) is no problem as well. However, I think there must be source of my problem: The checkbox doesn't show any value. How do I solve this?

a part of my VB-code
 Protected Sub gvProjects_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles gvProjects.ItemCommand  
        If e.CommandName = RadGrid.EditCommandName Then  
             Session("TaskId") = e.Item.OwnerTableView.Items(e.Item.ItemIndex)"TaskId").Text  
        End If 

My SQL-statement
<asp:SqlDataSource ID="dsCheckFile" runat="server"   
  ConnectionString="<%$ ConnectionStrings:DBPortal %>"   
  SelectCommand="SELECT tblFiles.FileId, tblFiles.FileName, FilesPerTask.FileId AS FileToTask, FilesPerTask.TaskId, tblFiles.ProjectId  
 FROM tblFiles LEFT OUTER JOIN FilesPerTask ON tblFiles.FileId = FilesPerTask.FileId  
 WHERE (tblFiles.ProjectId = @ProjectId)"> 
 
<SelectParameters> 
  <asp:SessionParameter Name="TaskId" SessionField="TaskId" Type="Int32"    Direction="Input" /> 
 
  <asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>  
</SelectParameters> 
 
</asp:SqlDataSource> 

10 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 15 Jul 2008, 12:34 PM
Hello A.,

Please try the following code instead of the ItemCommand event:

void RadGrid1_EditCommand(object source, GridCommandEventArgs e) 
    GridEditableItem item = e.Item as GridEditableItem; 
    Session["TaskID"] = (item.EditManager.GetColumnEditor("TaskID"as GridTextBoxColumnEditor).Text; 

Greetings,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mydatafactory
Top achievements
Rank 1
answered on 15 Jul 2008, 01:27 PM
Hello Veli,

Unfortunately, that doesn't work. What I discovered is that the chechkboxes show value if I attach it to one particular DataSourceID. If I copy that Datasource, rename it, and attach this renamed DataSourceId to the checkboxlist, then I get no value.
0
Veli
Telerik team
answered on 15 Jul 2008, 02:44 PM
Hello A.,

Could you, please, provide some sample code showing how you define your RadGrid and the checkbox list inside.

Sincerely yours,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mydatafactory
Top achievements
Rank 1
answered on 15 Jul 2008, 07:00 PM

Hello,

Below my .aspx code for defining the hierarchial RadGrid and the Checkboxlist inside


<body

>

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<telerik:RadGrid ID="gvProjects" runat="server" DataSourceID="dsProject"

GridLines="None" Skin="Office2007" AllowAutomaticDeletes="True"

AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowMultiRowSelection="True"

OnDetailTableDataBind="gvProjects_DetailTableDataBind"

OnNeedDataSource="gvProjects_NeedDataSource"

DataKeyNames ="ProjectId">

<PagerStyle Mode="NextPrevAndNumeric" />

<ClientSettings Selecting-AllowRowSelect="true">

<

Selecting AllowRowSelect="True"></Selecting>

</ClientSettings>

<

MasterTableView CommandItemDisplay="Bottom" DataKeyNames="ProjectId"

AllowPaging="True" AutoGenerateColumns="False" Name="Projects" AllowAutomaticDeletes="True"

AllowAutomaticInserts="True" AllowAutomaticUpdates="True">

<%

--DetailtableTaken--%>

<DetailTables>

<telerik:GridTableView runat="server" DataKeyNames="ProjectId,TaskId" DataSourceID="dsTasks"

CommandItemDisplay="Bottom" GridLines="None" Name="Tasks" PageSize="10"

PagerStyle-Mode="NextPrevAndNumeric" AllowPaging="True"

AutoGenerateColumns="False" Width="100%"

ExpandCollapseColumn-ButtonType="ImageButton" AllowAutomaticDeletes="True"

AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowSorting="True"

NoDetailRecordsText="No tasks to display.">

<DetailTables>

<telerik:GridTableView runat="server" CommandItemDisplay="Bottom" Name="FilesToTask"

AllowPaging="True"

PageSize="5"

AutoGenerateColumns="False"

Width="100%"

DataSourceID="dsFilesToTask"

DataKeyNames="TaskId, FileToTaskId">

<

RowIndicatorColumn Visible="false">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Visible="False" Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

 

<

ParentTableRelation>

<

telerik:GridRelationFields DetailKeyField="TaskId" MasterKeyField="TaskId" />

</

ParentTableRelation>

<Columns> <%--Files gekoppeld aan taken--%>

<telerik:GridBoundColumn

DataField="FileName" SortExpression="FileName" HeaderText="File" UniqueName="FileName">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn

DataField="FileId" sortExpression="FileId" HeaderText="File ID" UniqueName="FileId" Visible="False" ReadOnly="True">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn

Datafield="TaskId" SortExpression="TaskId" HeaderText="Task ID" UniqueName="TaskId" Visible="False" ReadOnly="true">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn

DataField="DownloadDate" SortExpression="DownloadDate" HeaderText="Download Date" UniqueName="DownloadDate" PickerType="DatePicker" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridDateTimeColumn

DataField="DateCreated" SortExpression="DateCreated" HeaderText="Date Created" UniqueName="DateCreated" Visible="False" PickerType="DatePicker" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridBoundColumn SortExpression="FileToTaskId" HeaderText="FileToTaskId"

DataField="FileToTaskId" UniqueName="FileToTaskId" Visible="false" ReadOnly="True"></telerik:GridBoundColumn>

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandFileToTask">

<headerstyle width="20px" />

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn

ConfirmText="Delete this File?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteFileToTask">

<HeaderStyle Width="20px" />

</telerik:GridButtonColumn>

</Columns>

<

EditFormSettings>

<EditColumn ButtonType="ImageButton" InsertText="Insert File" UpdateText="Update File" UniqueName="EditCommandColumn1" CancelText="Cancel Edit"></EditColumn>

<FormTableButtonRowStyle HorizontalAlign="right" />

<PopUpSettings ScrollBars="None"></PopUpSettings>

</

EditFormSettings>

<EditItemStyle BackColor="#00CC00" Font-Bold="False" Font-Italic="False"

Font-Overline="False" Font-Strikeout="False" Font-Underline="False"

ForeColor="#00CC00" Wrap="True" />

</telerik:GridTableView>

</DetailTables>

<

RowIndicatorColumn Visible="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<

ParentTableRelation>

<

telerik:GridRelationFields DetailKeyField="ProjectId" MasterKeyField="ProjectId" />

</

ParentTableRelation>

<%

--Columns Taken--%>

<Columns>

<telerik:GridBoundColumn

DataField="TaskId" HeaderText="TaskId" ReadOnly="True" SortExpression="TaskId" UniqueName="TaskId" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn

DataField="ProjectId" HeaderText="ProjectId" ReadOnly="True" SortExpression="ProjectId" UniqueName="ProjectId" Visible="false">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn

DataField="ReadyDate" HeaderText="Ready Date" SortExpression="ReadyDate" UniqueName="ReadyDate" Visible="False" PickerType="DatePicker"></telerik:GridDateTimeColumn>

<telerik:GridBoundColumn DataField="TaskDescription" SortExpression="TaskDescription" HeaderText="Description" Visible="true" UniqueName="TaskDescription"></telerik:GridBoundColumn>

<telerik:GridDropDownColumn

DataField="BewerkingId" DataSourceID="dsTaskList" HeaderText="Task" ListTextField="SoortBewerking" ListValueField="BewerkingId" UniqueName="SoortBewerking">

</telerik:GridDropDownColumn>

<telerik:GridDropDownColumn

DataField="UserId" DataSourceID="dsUsers" HeaderText="User" ListTextField="Name" ListValueField="UserId" UniqueName="UserId">

</telerik:GridDropDownColumn>

<telerik:GridBoundColumn

DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" UniqueName="Remarks" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn

DataField="Date" HeaderText="Date" UniqueName="Date" Visible="False" PickerType="DatePicker"></telerik:GridDateTimeColumn>

<telerik:GridDateTimeColumn

DataField="StartDate" HeaderText="Start Date" SortExpression="StartDate" UniqueName="StartDate" PickerType="DatePicker" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridNumericColumn

SortExpression="EstimatedHours" DataField="EstimatedHours" HeaderText="Estimated Hours" UniqueName="EstimatedHours" Visible="true">

</telerik:GridNumericColumn>

<telerik:GridDateTimeColumn

SortExpression="EstimatedReadyDate" DataField="EstimatedReadyDate" UniqueName="EstimatedReadyDate" HeaderText="Estimated Date Finished" Visible="true" PickerType="DatePicker" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridNumericColumn

SortExpression="RealHours" DataField="RealHours" HeaderText="Real Hours" UniqueName="RealHours" Visible="false">

</telerik:GridNumericColumn>

<telerik:GridNumericColumn

SortExpression="NumberArticles" DataField="NumberArticles" HeaderText="Number of Articles" UniqueName="NumberArticles" Visible="true">

</telerik:GridNumericColumn>

<telerik:GridDropDownColumn

DataField="StatusId" DataSourceID="dsStatus" HeaderText="Status" ListTextField="StatusNam" ListValueField="StatusId" UniqueName="ddlStatus">

</telerik:GridDropDownColumn>

<telerik:GridDateTimeColumn

DataField="DateSendDataSteward" SortExpression="DateSendDataSteward" HeaderText="Date Mail" PickerType="None" UniqueName="DateSendDataSteward" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridTemplateColumn UniqueName="TempCol">

<EditItemTemplate>

<asp:Panel ID="Panel1" runat="server">

<asp:CheckBoxList ID="chkTasks" runat="server"

DataTextField="FileName" DataValueField="FileId"

DataSourceID="dsFileschk" DataMember="DefaultView" AutoPostBack="True"

OnSelectedIndexChanged="chkTasks_CheckedChanged">

</asp:CheckBoxList>

</asp:Panel>

</EditItemTemplate>

<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />

</

telerik:GridTemplateColumn>

<telerik:GridEditCommandColumn

ButtonType="ImageButton" UniqueName="EditCommandTask">

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn

ButtonType="ImageButton" CommandName="Delete" ConfirmDialogType="RadWindow" Text="Delete" UniqueName="DeleteTask">

</telerik:GridButtonColumn>

</Columns>

<

EditFormSettings>

<EditColumn

ButtonType="ImageButton" InsertText="Insert Task" UpdateText="Update Task" UniqueName="EditCommandColumn1" CancelText="Candel Edit" >

</EditColumn>

<PopUpSettings ScrollBars="None">

</PopUpSettings>

<FormTableButtonRowStyle HorizontalAlign="Right" />

</

EditFormSettings>

<

PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>

</telerik:GridTableView>

<%

-- Files gekoppeld aan project--%>

<telerik:GridTableView runat="server" DataKeyNames="ProjectId, FileId"

CommandItemDisplay="Bottom" Name="Files" PageSize="10"

PagerStyle-Mode="NextPrevAndNumeric" AllowPaging="true"

DataSourceID="dsFiles"

AutoGenerateColumns="False" Width="100%"

NoDetailRecordsText="No Files to display">

<

RowIndicatorColumn Visible="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Visible="False" Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<

ParentTableRelation>

<

telerik:GridRelationFields DetailKeyField="ProjectId" MasterKeyField="ProjectId" />

</

ParentTableRelation>

<%

--Columns Files gekoppeld aan project--%>

<Columns>

<telerik:GridTemplateColumn DataField="FileName" HeaderText="File"

SortExpression="FileName" UniqueName="FileSaveAs">

<EditItemTemplate>

<asp:TextBox ID="txtFileDescription" runat="server" Text='<%#Eval("FileName") %>'></asp:TextBox>

</EditItemTemplate>

<ItemTemplate>

<asp:Label ID="lblFileDescription" runat="server" Text='<%#Eval("FileName") %>'></asp:Label>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandFile" EditFormColumnIndex="2">

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn ConfirmText="Delete this task?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteFile">

<HeaderStyle Width="20px" />

</telerik:GridButtonColumn>

<telerik:GridTemplateColumn DataField="FileId" SortExpression="FileId"

UniqueName="FileId" Visible="False">

</telerik:GridTemplateColumn>

</Columns>

<

EditFormSettings>

<

EditColumn ButtonType="ImageButton" InsertText="Insert Company" UpdateText="Update Company" UniqueName="EditCommandColumn1" CancelText="Candel Edit">

</

EditColumn>

<

PopUpSettings ScrollBars="None"></PopUpSettings>

<

FormTableButtonRowStyle HorizontalAlign="Right" />

</

EditFormSettings>

<

PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>

</telerik:GridTableView>

</DetailTables>

<%

--Columns Project--%>

<Columns>

<telerik:GridBoundColumn DataField="ProjectId" DataType="System.Int32"

HeaderText="ProjectId" ReadOnly="True" SortExpression="ProjectId"

UniqueName="ProjectId" Visible="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="ProjectName" HeaderText="ProjectName"

SortExpression="ProjectName" UniqueName="ProjectName">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="ProjectDescription"

HeaderText="ProjectDescription" SortExpression="ProjectDescription"

UniqueName="ProjectDescription" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks"

SortExpression="Remarks" UniqueName="Remarks" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridDropDownColumn DataField="CompanyId" DataSourceID="dsCompany" HeaderText="Company" ListTextField="CompanyName" ListValueField="CompanyId" UniqueName="Cust">

</telerik:GridDropDownColumn>

<telerik:GridNumericColumn DataField="ContractNummer" DataType="System.Int64"

HeaderText="ContractNummer" SortExpression="ContractNummer" UniqueName="ContractNummer"></telerik:GridNumericColumn>

<telerik:GridDropDownColumn DataField="DataSupplierId" DataSourceID="dsDataSup" HeaderText="Supplier" ListTextField="CompanyName" ListValueField="CompanyId" UniqueName="DataSup">

</telerik:GridDropDownColumn>

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandProject">

<headerstyle width="20px" />

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn ConfirmText="Delete this task?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteProject">

<HeaderStyle Width="20px" />

</telerik:GridButtonColumn>

</Columns>

<

RowIndicatorColumn Visible="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<

EditFormSettings>

<

EditColumn ButtonType="ImageButton" InsertText="Insert" UpdateText="Update" UniqueName="EditCommandColumn1" CancelText="Candel Edit">

</

EditColumn>

<

FormTableButtonRowStyle HorizontalAlign="Right" />

<

PopUpSettings ScrollBars="None"></PopUpSettings>

</

EditFormSettings>

</

MasterTableView>

</telerik:RadGrid>

<asp:SqlDataSource ID="dsProject" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

DeleteCommand="DELETE FROM [tblProjects] WHERE [ProjectId] = @ProjectId"

InsertCommand="INSERT INTO [tblProjects] ([ProjectName], [ProjectDescription], [Remarks], [CompanyId], [ContractNummer], [DataSupplierId]) VALUES (@ProjectName, @ProjectDescription, @Remarks, @CompanyId, @ContractNummer, @DataSupplierId)"

SelectCommand="SELECT ProjectId, ProjectName, ProjectDescription, Remarks, CompanyId, ContractNummer, DataSupplierId FROM tblProjects"

UpdateCommand="UPDATE [tblProjects] SET [ProjectName] = @ProjectName, [ProjectDescription] = @ProjectDescription, [Remarks] = @Remarks, [CompanyId] = @CompanyId, [ContractNummer] = @ContractNummer, [DataSupplierId] = @DataSupplierId WHERE [ProjectId] = @ProjectId">

<DeleteParameters>

<asp:Parameter Name="ProjectId" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="ProjectName" Type="String" />

<asp:Parameter Name="ProjectDescription" Type="String" />

<asp:Parameter Name="Remarks" Type="String" />

<asp:Parameter Name="CompanyId" Type="Int32" />

<asp:Parameter Name="ContractNummer" Type="Int64" />

<asp:Parameter Name="DataSupplierId" Type="Int32" />

<asp:Parameter Name="ProjectId" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="ProjectName" Type="String" />

<asp:Parameter Name="ProjectDescription" Type="String" />

<asp:Parameter Name="Remarks" Type="String" />

<asp:Parameter Name="CompanyId" Type="Int32" />

<asp:Parameter Name="ContractNummer" Type="Int64" />

<asp:Parameter Name="DataSupplierId" Type="Int32" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsCompany" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT CompanyId, CompanyName FROM tblCompany WHERE (Rol_Cust = 'True')">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsDataSup" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT CompanyId, CompanyName FROM tblCompany WHERE (Rol_DataSup = 'True')">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsFiles" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblFiles] WHERE ([ProjectId] = @ProjectId)"

DeleteCommand="DELETE FROM [tblFiles] WHERE [FileId] = @original_FileId AND [ProjectId] = @original_ProjectId AND [FileName] = @original_FileName AND [FileSaveAs] = @original_FileSaveAs AND [DownloadDate] = @original_DownloadDate AND [FileDescription] = @original_FileDescription"

ConflictDetection="CompareAllValues"

InsertCommand="INSERT INTO [tblFiles] ([FileName], [FileSaveAs], [ProjectId], [DownloadDate], [FileDescription]) VALUES (@FileName, @FileSaveAs, @ProjectId, @DownloadDate, @FileDescription)"

OldValuesParameterFormatString="original_{0}"

UpdateCommand="UPDATE [tblFiles] SET [FileName] = @FileName, [FileSaveAs] = @FileSaveAs, [DownloadDate] = @DownloadDate, [FileDescription] = @FileDescription WHERE [FileId] = @original_FileId AND [ProjectId] = @original_ProjectId AND [FileName] = @original_FileName AND [FileSaveAs] = @original_FileSaveAs AND [DownloadDate] = @original_DownloadDate AND [FileDescription] = @original_FileDescription">

<%

-- <SelectParameters>

<asp:Parameter Name="ProjectId" Type="Int32" />

</SelectParameters>--

%>

<SelectParameters>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>

</SelectParameters>

<DeleteParameters>

<asp:Parameter Name="original_FileId" Type="Int32" />

<asp:Parameter Name="original_ProjectId" Type="Int32" />

<asp:Parameter Name="original_FileName" Type="String" />

<asp:Parameter Name="original_FileSaveAs" Type="String" />

<asp:Parameter Name="original_DownloadDate" Type="DateTime" />

<asp:Parameter Name="original_FileDescription" Type="String" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="FileName" Type="String" />

<asp:Parameter Name="FileSaveAs" Type="String" />

<asp:Parameter Name="DownloadDate" Type="DateTime" />

<asp:Parameter Name="FileDescription" Type="String" />

<asp:Parameter Name="original_FileId" Type="Int32" />

<asp:Parameter Name="original_ProjectId" Type="Int32" />

<asp:Parameter Name="original_FileName" Type="String" />

<asp:Parameter Name="original_FileSaveAs" Type="String" />

<asp:Parameter Name="original_DownloadDate" Type="DateTime" />

<asp:Parameter Name="original_FileDescription" Type="String" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="FileName" Type="String" />

<asp:Parameter Name="FileSaveAs" Type="String" />

<%

-- <asp:Parameter Name="ProjectId" Type="Int32" />--%>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32"/>

<asp:Parameter Name="DownloadDate" Type="DateTime" />

<asp:Parameter Name="FileDescription" Type="String" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsTasks" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblTasks] WHERE ProjectId = @ProjectId"

DeleteCommand="DELETE FROM [tblTasks] WHERE [TaskId] = @TaskId"

InsertCommand="INSERT INTO [tblTasks] ([ProjectId], [BewerkingId], [UserId], [ReadyDate], [TaskDescription], [Remarks], [Date], [StartDate], [EstimatedHours], [RealHours], [NumberArticles], [EstimatedReadyDate], [Status_actief], [StatusId], [DateSendDataSteward]) VALUES (@ProjectId, @BewerkingId, @UserId, @ReadyDate, @TaskDescription, @Remarks, @Date, @StartDate, @EstimatedHours, @RealHours, @NumberArticles, @EstimatedReadyDate, @Status_actief, @StatusId, @DateSendDataSteward)"

UpdateCommand="UPDATE [tblTasks] SET [ProjectId] = @ProjectId, [BewerkingId] = @BewerkingId, [UserId] = @UserId, [ReadyDate] = @ReadyDate, [TaskDescription] = @TaskDescription, [Remarks] = @Remarks, [Date] = @Date, [StartDate] = @StartDate, [EstimatedHours] = @EstimatedHours, [RealHours] = @RealHours, [NumberArticles] = @NumberArticles, [EstimatedReadyDate] = @EstimatedReadyDate,[Status_actief] = @Status_actief, [StatusId]=@StatusId, [DateSendDataSteward] =@DateSendDataSteward WHERE [TaskId] = @TaskId">

<SelectParameters>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>

</SelectParameters>

<DeleteParameters>

<asp:Parameter Name="TaskId" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="ProjectId" Type="Int32" />

<asp:Parameter Name="BewerkingId" Type="Int32" />

<asp:Parameter Name="UserId" Type="Int32" />

<asp:Parameter Name="ReadyDate" Type="DateTime" />

<asp:Parameter Name="TaskDescription" Type="String" />

<asp:Parameter Name="Remarks" Type="String" />

<asp:Parameter Name="Date" Type="DateTime" />

<asp:Parameter Name="StartDate" Type="DateTime" />

<asp:Parameter Name="EstimatedHours" Type="Int32" />

<asp:Parameter Name="RealHours" Type="Int32" />

<asp:Parameter Name="NumberArticles" Type="Int64" />

<asp:Parameter Name="EstimatedReadyDate" Type="DateTime" />

<asp:Parameter Name="Status_actief" Type="String" />

<asp:Parameter Name="DateSendDataSteward" Type="DateTime" />

<asp:Parameter Name="TaskId" />

</UpdateParameters>

<InsertParameters>

<%

--<asp:Parameter Name="ProjectId"

Type="Int32" />--

%>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32"/>

<asp:Parameter Name="BewerkingId" Type="Int32" />

<asp:Parameter Name="UserId" Type="Int32" />

<asp:Parameter Name="ReadyDate" Type="DateTime" />

<asp:Parameter Name="TaskDescription" Type="String" />

<asp:Parameter Name="Remarks" Type="String" />

<asp:Parameter Name="Date" Type="DateTime" />

<asp:Parameter Name="StartDate" Type="DateTime" />

<asp:Parameter Name="EstimatedHours" Type="Int32" />

<asp:Parameter Name="RealHours" Type="Int32" />

<asp:Parameter Name="NumberArticles" Type="Int64" />

<asp:Parameter Name="EstimatedReadyDate" Type="DateTime" />

<asp:Parameter Name="Status_actief" Type="String" />

<asp:Parameter Name="DateSendDataSteward" Type="DateTime" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsTaskList" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblBewerkingen]">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsFilesToTask" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [FilesPerTask] where TaskId = @TaskId">

<SelectParameters>

<asp:SessionParameter Name="TaskId" SessionField="TaskId" Type="Int32" Direction="Input"/>

</SelectParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsUsers" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblUsers]">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsCheckFile" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT tblFiles.FileId, tblFiles.FileName, FilesPerTask.FileId AS FileToTask, FilesPerTask.TaskId, tblFiles.ProjectId FROM tblFiles LEFT OUTER JOIN FilesPerTask ON tblFiles.FileId = FilesPerTask.FileId WHERE (tblFiles.ProjectId = @ProjectId)">

<SelectParameters>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>

</SelectParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsStatus" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblStatusTasks]">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsFileschk" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblFiles] WHERE ([ProjectId] = @ProjectId)"

DeleteCommand="DELETE FROM [tblFiles] WHERE [FileId] = @original_FileId AND [ProjectId] = @original_ProjectId AND [FileName] = @original_FileName AND [FileSaveAs] = @original_FileSaveAs AND [DownloadDate] = @original_DownloadDate AND [FileDescription] = @original_FileDescription"

ConflictDetection="CompareAllValues"

InsertCommand="INSERT INTO [tblFiles] ([FileName], [FileSaveAs], [ProjectId], [DownloadDate], [FileDescription]) VALUES (@FileName, @FileSaveAs, @ProjectId, @DownloadDate, @FileDescription)"

OldValuesParameterFormatString="original_{0}"

UpdateCommand="UPDATE [tblFiles] SET [FileName] = @FileName, [FileSaveAs] = @FileSaveAs, [DownloadDate] = @DownloadDate, [FileDescription] = @FileDescription WHERE [FileId] = @original_FileId AND [ProjectId] = @original_ProjectId AND [FileName] = @original_FileName AND [FileSaveAs] = @original_FileSaveAs AND [DownloadDate] = @original_DownloadDate AND [FileDescription] = @original_FileDescription">

<%

-- <SelectParameters>

<asp:Parameter Name="ProjectId" Type="Int32" />

</SelectParameters>--

%>

<SelectParameters>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>

</SelectParameters>

<DeleteParameters>

<asp:Parameter Name="original_FileId" Type="Int32" />

<asp:Parameter Name="original_ProjectId" Type="Int32" />

<asp:Parameter Name="original_FileName" Type="String" />

<asp:Parameter Name="original_FileSaveAs" Type="String" />

<asp:Parameter Name="original_DownloadDate" Type="DateTime" />

<asp:Parameter Name="original_FileDescription" Type="String" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="FileName" Type="String" />

<asp:Parameter Name="FileSaveAs" Type="String" />

<asp:Parameter Name="DownloadDate" Type="DateTime" />

<asp:Parameter Name="FileDescription" Type="String" />

<asp:Parameter Name="original_FileId" Type="Int32" />

<asp:Parameter Name="original_ProjectId" Type="Int32" />

<asp:Parameter Name="original_FileName" Type="String" />

<asp:Parameter Name="original_FileSaveAs" Type="String" />

<asp:Parameter Name="original_DownloadDate" Type="DateTime" />

<asp:Parameter Name="original_FileDescription" Type="String" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="FileName" Type="String" />

<asp:Parameter Name="FileSaveAs" Type="String" />

<%

-- <asp:Parameter Name="ProjectId" Type="Int32" />--%>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32"/>

<asp:Parameter Name="DownloadDate" Type="DateTime" />

<asp:Parameter Name="FileDescription" Type="String" />

</InsertParameters>

</asp:SqlDataSource>

</form>

</

body>

0
Mydatafactory
Top achievements
Rank 1
answered on 15 Jul 2008, 07:00 PM

Hello,

Below my .aspx code for defining the hierarchial RadGrid and the Checkboxlist inside


<body

>

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<telerik:RadGrid ID="gvProjects" runat="server" DataSourceID="dsProject"

GridLines="None" Skin="Office2007" AllowAutomaticDeletes="True"

AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowMultiRowSelection="True"

OnDetailTableDataBind="gvProjects_DetailTableDataBind"

OnNeedDataSource="gvProjects_NeedDataSource"

DataKeyNames ="ProjectId">

<PagerStyle Mode="NextPrevAndNumeric" />

<ClientSettings Selecting-AllowRowSelect="true">

<

Selecting AllowRowSelect="True"></Selecting>

</ClientSettings>

<

MasterTableView CommandItemDisplay="Bottom" DataKeyNames="ProjectId"

AllowPaging="True" AutoGenerateColumns="False" Name="Projects" AllowAutomaticDeletes="True"

AllowAutomaticInserts="True" AllowAutomaticUpdates="True">

<%

--DetailtableTaken--%>

<DetailTables>

<telerik:GridTableView runat="server" DataKeyNames="ProjectId,TaskId" DataSourceID="dsTasks"

CommandItemDisplay="Bottom" GridLines="None" Name="Tasks" PageSize="10"

PagerStyle-Mode="NextPrevAndNumeric" AllowPaging="True"

AutoGenerateColumns="False" Width="100%"

ExpandCollapseColumn-ButtonType="ImageButton" AllowAutomaticDeletes="True"

AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowSorting="True"

NoDetailRecordsText="No tasks to display.">

<DetailTables>

<telerik:GridTableView runat="server" CommandItemDisplay="Bottom" Name="FilesToTask"

AllowPaging="True"

PageSize="5"

AutoGenerateColumns="False"

Width="100%"

DataSourceID="dsFilesToTask"

DataKeyNames="TaskId, FileToTaskId">

<

RowIndicatorColumn Visible="false">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Visible="False" Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

 

<

ParentTableRelation>

<

telerik:GridRelationFields DetailKeyField="TaskId" MasterKeyField="TaskId" />

</

ParentTableRelation>

<Columns> <%--Files gekoppeld aan taken--%>

<telerik:GridBoundColumn

DataField="FileName" SortExpression="FileName" HeaderText="File" UniqueName="FileName">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn

DataField="FileId" sortExpression="FileId" HeaderText="File ID" UniqueName="FileId" Visible="False" ReadOnly="True">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn

Datafield="TaskId" SortExpression="TaskId" HeaderText="Task ID" UniqueName="TaskId" Visible="False" ReadOnly="true">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn

DataField="DownloadDate" SortExpression="DownloadDate" HeaderText="Download Date" UniqueName="DownloadDate" PickerType="DatePicker" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridDateTimeColumn

DataField="DateCreated" SortExpression="DateCreated" HeaderText="Date Created" UniqueName="DateCreated" Visible="False" PickerType="DatePicker" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridBoundColumn SortExpression="FileToTaskId" HeaderText="FileToTaskId"

DataField="FileToTaskId" UniqueName="FileToTaskId" Visible="false" ReadOnly="True"></telerik:GridBoundColumn>

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandFileToTask">

<headerstyle width="20px" />

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn

ConfirmText="Delete this File?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteFileToTask">

<HeaderStyle Width="20px" />

</telerik:GridButtonColumn>

</Columns>

<

EditFormSettings>

<EditColumn ButtonType="ImageButton" InsertText="Insert File" UpdateText="Update File" UniqueName="EditCommandColumn1" CancelText="Cancel Edit"></EditColumn>

<FormTableButtonRowStyle HorizontalAlign="right" />

<PopUpSettings ScrollBars="None"></PopUpSettings>

</

EditFormSettings>

<EditItemStyle BackColor="#00CC00" Font-Bold="False" Font-Italic="False"

Font-Overline="False" Font-Strikeout="False" Font-Underline="False"

ForeColor="#00CC00" Wrap="True" />

</telerik:GridTableView>

</DetailTables>

<

RowIndicatorColumn Visible="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<

ParentTableRelation>

<

telerik:GridRelationFields DetailKeyField="ProjectId" MasterKeyField="ProjectId" />

</

ParentTableRelation>

<%

--Columns Taken--%>

<Columns>

<telerik:GridBoundColumn

DataField="TaskId" HeaderText="TaskId" ReadOnly="True" SortExpression="TaskId" UniqueName="TaskId" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn

DataField="ProjectId" HeaderText="ProjectId" ReadOnly="True" SortExpression="ProjectId" UniqueName="ProjectId" Visible="false">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn

DataField="ReadyDate" HeaderText="Ready Date" SortExpression="ReadyDate" UniqueName="ReadyDate" Visible="False" PickerType="DatePicker"></telerik:GridDateTimeColumn>

<telerik:GridBoundColumn DataField="TaskDescription" SortExpression="TaskDescription" HeaderText="Description" Visible="true" UniqueName="TaskDescription"></telerik:GridBoundColumn>

<telerik:GridDropDownColumn

DataField="BewerkingId" DataSourceID="dsTaskList" HeaderText="Task" ListTextField="SoortBewerking" ListValueField="BewerkingId" UniqueName="SoortBewerking">

</telerik:GridDropDownColumn>

<telerik:GridDropDownColumn

DataField="UserId" DataSourceID="dsUsers" HeaderText="User" ListTextField="Name" ListValueField="UserId" UniqueName="UserId">

</telerik:GridDropDownColumn>

<telerik:GridBoundColumn

DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" UniqueName="Remarks" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridDateTimeColumn

DataField="Date" HeaderText="Date" UniqueName="Date" Visible="False" PickerType="DatePicker"></telerik:GridDateTimeColumn>

<telerik:GridDateTimeColumn

DataField="StartDate" HeaderText="Start Date" SortExpression="StartDate" UniqueName="StartDate" PickerType="DatePicker" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridNumericColumn

SortExpression="EstimatedHours" DataField="EstimatedHours" HeaderText="Estimated Hours" UniqueName="EstimatedHours" Visible="true">

</telerik:GridNumericColumn>

<telerik:GridDateTimeColumn

SortExpression="EstimatedReadyDate" DataField="EstimatedReadyDate" UniqueName="EstimatedReadyDate" HeaderText="Estimated Date Finished" Visible="true" PickerType="DatePicker" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridNumericColumn

SortExpression="RealHours" DataField="RealHours" HeaderText="Real Hours" UniqueName="RealHours" Visible="false">

</telerik:GridNumericColumn>

<telerik:GridNumericColumn

SortExpression="NumberArticles" DataField="NumberArticles" HeaderText="Number of Articles" UniqueName="NumberArticles" Visible="true">

</telerik:GridNumericColumn>

<telerik:GridDropDownColumn

DataField="StatusId" DataSourceID="dsStatus" HeaderText="Status" ListTextField="StatusNam" ListValueField="StatusId" UniqueName="ddlStatus">

</telerik:GridDropDownColumn>

<telerik:GridDateTimeColumn

DataField="DateSendDataSteward" SortExpression="DateSendDataSteward" HeaderText="Date Mail" PickerType="None" UniqueName="DateSendDataSteward" DataFormatString="{0:d}">

</telerik:GridDateTimeColumn>

<telerik:GridTemplateColumn UniqueName="TempCol">

<EditItemTemplate>

<asp:Panel ID="Panel1" runat="server">

<asp:CheckBoxList ID="chkTasks" runat="server"

DataTextField="FileName" DataValueField="FileId"

DataSourceID="dsFileschk" DataMember="DefaultView" AutoPostBack="True"

OnSelectedIndexChanged="chkTasks_CheckedChanged">

</asp:CheckBoxList>

</asp:Panel>

</EditItemTemplate>

<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />

</

telerik:GridTemplateColumn>

<telerik:GridEditCommandColumn

ButtonType="ImageButton" UniqueName="EditCommandTask">

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn

ButtonType="ImageButton" CommandName="Delete" ConfirmDialogType="RadWindow" Text="Delete" UniqueName="DeleteTask">

</telerik:GridButtonColumn>

</Columns>

<

EditFormSettings>

<EditColumn

ButtonType="ImageButton" InsertText="Insert Task" UpdateText="Update Task" UniqueName="EditCommandColumn1" CancelText="Candel Edit" >

</EditColumn>

<PopUpSettings ScrollBars="None">

</PopUpSettings>

<FormTableButtonRowStyle HorizontalAlign="Right" />

</

EditFormSettings>

<

PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>

</telerik:GridTableView>

<%

-- Files gekoppeld aan project--%>

<telerik:GridTableView runat="server" DataKeyNames="ProjectId, FileId"

CommandItemDisplay="Bottom" Name="Files" PageSize="10"

PagerStyle-Mode="NextPrevAndNumeric" AllowPaging="true"

DataSourceID="dsFiles"

AutoGenerateColumns="False" Width="100%"

NoDetailRecordsText="No Files to display">

<

RowIndicatorColumn Visible="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Visible="False" Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<

ParentTableRelation>

<

telerik:GridRelationFields DetailKeyField="ProjectId" MasterKeyField="ProjectId" />

</

ParentTableRelation>

<%

--Columns Files gekoppeld aan project--%>

<Columns>

<telerik:GridTemplateColumn DataField="FileName" HeaderText="File"

SortExpression="FileName" UniqueName="FileSaveAs">

<EditItemTemplate>

<asp:TextBox ID="txtFileDescription" runat="server" Text='<%#Eval("FileName") %>'></asp:TextBox>

</EditItemTemplate>

<ItemTemplate>

<asp:Label ID="lblFileDescription" runat="server" Text='<%#Eval("FileName") %>'></asp:Label>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandFile" EditFormColumnIndex="2">

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn ConfirmText="Delete this task?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteFile">

<HeaderStyle Width="20px" />

</telerik:GridButtonColumn>

<telerik:GridTemplateColumn DataField="FileId" SortExpression="FileId"

UniqueName="FileId" Visible="False">

</telerik:GridTemplateColumn>

</Columns>

<

EditFormSettings>

<

EditColumn ButtonType="ImageButton" InsertText="Insert Company" UpdateText="Update Company" UniqueName="EditCommandColumn1" CancelText="Candel Edit">

</

EditColumn>

<

PopUpSettings ScrollBars="None"></PopUpSettings>

<

FormTableButtonRowStyle HorizontalAlign="Right" />

</

EditFormSettings>

<

PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>

</telerik:GridTableView>

</DetailTables>

<%

--Columns Project--%>

<Columns>

<telerik:GridBoundColumn DataField="ProjectId" DataType="System.Int32"

HeaderText="ProjectId" ReadOnly="True" SortExpression="ProjectId"

UniqueName="ProjectId" Visible="false">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="ProjectName" HeaderText="ProjectName"

SortExpression="ProjectName" UniqueName="ProjectName">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="ProjectDescription"

HeaderText="ProjectDescription" SortExpression="ProjectDescription"

UniqueName="ProjectDescription" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks"

SortExpression="Remarks" UniqueName="Remarks" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridDropDownColumn DataField="CompanyId" DataSourceID="dsCompany" HeaderText="Company" ListTextField="CompanyName" ListValueField="CompanyId" UniqueName="Cust">

</telerik:GridDropDownColumn>

<telerik:GridNumericColumn DataField="ContractNummer" DataType="System.Int64"

HeaderText="ContractNummer" SortExpression="ContractNummer" UniqueName="ContractNummer"></telerik:GridNumericColumn>

<telerik:GridDropDownColumn DataField="DataSupplierId" DataSourceID="dsDataSup" HeaderText="Supplier" ListTextField="CompanyName" ListValueField="CompanyId" UniqueName="DataSup">

</telerik:GridDropDownColumn>

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandProject">

<headerstyle width="20px" />

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn ConfirmText="Delete this task?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteProject">

<HeaderStyle Width="20px" />

</telerik:GridButtonColumn>

</Columns>

<

RowIndicatorColumn Visible="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<

EditFormSettings>

<

EditColumn ButtonType="ImageButton" InsertText="Insert" UpdateText="Update" UniqueName="EditCommandColumn1" CancelText="Candel Edit">

</

EditColumn>

<

FormTableButtonRowStyle HorizontalAlign="Right" />

<

PopUpSettings ScrollBars="None"></PopUpSettings>

</

EditFormSettings>

</

MasterTableView>

</telerik:RadGrid>

<asp:SqlDataSource ID="dsProject" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

DeleteCommand="DELETE FROM [tblProjects] WHERE [ProjectId] = @ProjectId"

InsertCommand="INSERT INTO [tblProjects] ([ProjectName], [ProjectDescription], [Remarks], [CompanyId], [ContractNummer], [DataSupplierId]) VALUES (@ProjectName, @ProjectDescription, @Remarks, @CompanyId, @ContractNummer, @DataSupplierId)"

SelectCommand="SELECT ProjectId, ProjectName, ProjectDescription, Remarks, CompanyId, ContractNummer, DataSupplierId FROM tblProjects"

UpdateCommand="UPDATE [tblProjects] SET [ProjectName] = @ProjectName, [ProjectDescription] = @ProjectDescription, [Remarks] = @Remarks, [CompanyId] = @CompanyId, [ContractNummer] = @ContractNummer, [DataSupplierId] = @DataSupplierId WHERE [ProjectId] = @ProjectId">

<DeleteParameters>

<asp:Parameter Name="ProjectId" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="ProjectName" Type="String" />

<asp:Parameter Name="ProjectDescription" Type="String" />

<asp:Parameter Name="Remarks" Type="String" />

<asp:Parameter Name="CompanyId" Type="Int32" />

<asp:Parameter Name="ContractNummer" Type="Int64" />

<asp:Parameter Name="DataSupplierId" Type="Int32" />

<asp:Parameter Name="ProjectId" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="ProjectName" Type="String" />

<asp:Parameter Name="ProjectDescription" Type="String" />

<asp:Parameter Name="Remarks" Type="String" />

<asp:Parameter Name="CompanyId" Type="Int32" />

<asp:Parameter Name="ContractNummer" Type="Int64" />

<asp:Parameter Name="DataSupplierId" Type="Int32" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsCompany" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT CompanyId, CompanyName FROM tblCompany WHERE (Rol_Cust = 'True')">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsDataSup" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT CompanyId, CompanyName FROM tblCompany WHERE (Rol_DataSup = 'True')">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsFiles" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblFiles] WHERE ([ProjectId] = @ProjectId)"

DeleteCommand="DELETE FROM [tblFiles] WHERE [FileId] = @original_FileId AND [ProjectId] = @original_ProjectId AND [FileName] = @original_FileName AND [FileSaveAs] = @original_FileSaveAs AND [DownloadDate] = @original_DownloadDate AND [FileDescription] = @original_FileDescription"

ConflictDetection="CompareAllValues"

InsertCommand="INSERT INTO [tblFiles] ([FileName], [FileSaveAs], [ProjectId], [DownloadDate], [FileDescription]) VALUES (@FileName, @FileSaveAs, @ProjectId, @DownloadDate, @FileDescription)"

OldValuesParameterFormatString="original_{0}"

UpdateCommand="UPDATE [tblFiles] SET [FileName] = @FileName, [FileSaveAs] = @FileSaveAs, [DownloadDate] = @DownloadDate, [FileDescription] = @FileDescription WHERE [FileId] = @original_FileId AND [ProjectId] = @original_ProjectId AND [FileName] = @original_FileName AND [FileSaveAs] = @original_FileSaveAs AND [DownloadDate] = @original_DownloadDate AND [FileDescription] = @original_FileDescription">

<%

-- <SelectParameters>

<asp:Parameter Name="ProjectId" Type="Int32" />

</SelectParameters>--

%>

<SelectParameters>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>

</SelectParameters>

<DeleteParameters>

<asp:Parameter Name="original_FileId" Type="Int32" />

<asp:Parameter Name="original_ProjectId" Type="Int32" />

<asp:Parameter Name="original_FileName" Type="String" />

<asp:Parameter Name="original_FileSaveAs" Type="String" />

<asp:Parameter Name="original_DownloadDate" Type="DateTime" />

<asp:Parameter Name="original_FileDescription" Type="String" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="FileName" Type="String" />

<asp:Parameter Name="FileSaveAs" Type="String" />

<asp:Parameter Name="DownloadDate" Type="DateTime" />

<asp:Parameter Name="FileDescription" Type="String" />

<asp:Parameter Name="original_FileId" Type="Int32" />

<asp:Parameter Name="original_ProjectId" Type="Int32" />

<asp:Parameter Name="original_FileName" Type="String" />

<asp:Parameter Name="original_FileSaveAs" Type="String" />

<asp:Parameter Name="original_DownloadDate" Type="DateTime" />

<asp:Parameter Name="original_FileDescription" Type="String" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="FileName" Type="String" />

<asp:Parameter Name="FileSaveAs" Type="String" />

<%

-- <asp:Parameter Name="ProjectId" Type="Int32" />--%>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32"/>

<asp:Parameter Name="DownloadDate" Type="DateTime" />

<asp:Parameter Name="FileDescription" Type="String" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsTasks" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblTasks] WHERE ProjectId = @ProjectId"

DeleteCommand="DELETE FROM [tblTasks] WHERE [TaskId] = @TaskId"

InsertCommand="INSERT INTO [tblTasks] ([ProjectId], [BewerkingId], [UserId], [ReadyDate], [TaskDescription], [Remarks], [Date], [StartDate], [EstimatedHours], [RealHours], [NumberArticles], [EstimatedReadyDate], [Status_actief], [StatusId], [DateSendDataSteward]) VALUES (@ProjectId, @BewerkingId, @UserId, @ReadyDate, @TaskDescription, @Remarks, @Date, @StartDate, @EstimatedHours, @RealHours, @NumberArticles, @EstimatedReadyDate, @Status_actief, @StatusId, @DateSendDataSteward)"

UpdateCommand="UPDATE [tblTasks] SET [ProjectId] = @ProjectId, [BewerkingId] = @BewerkingId, [UserId] = @UserId, [ReadyDate] = @ReadyDate, [TaskDescription] = @TaskDescription, [Remarks] = @Remarks, [Date] = @Date, [StartDate] = @StartDate, [EstimatedHours] = @EstimatedHours, [RealHours] = @RealHours, [NumberArticles] = @NumberArticles, [EstimatedReadyDate] = @EstimatedReadyDate,[Status_actief] = @Status_actief, [StatusId]=@StatusId, [DateSendDataSteward] =@DateSendDataSteward WHERE [TaskId] = @TaskId">

<SelectParameters>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>

</SelectParameters>

<DeleteParameters>

<asp:Parameter Name="TaskId" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="ProjectId" Type="Int32" />

<asp:Parameter Name="BewerkingId" Type="Int32" />

<asp:Parameter Name="UserId" Type="Int32" />

<asp:Parameter Name="ReadyDate" Type="DateTime" />

<asp:Parameter Name="TaskDescription" Type="String" />

<asp:Parameter Name="Remarks" Type="String" />

<asp:Parameter Name="Date" Type="DateTime" />

<asp:Parameter Name="StartDate" Type="DateTime" />

<asp:Parameter Name="EstimatedHours" Type="Int32" />

<asp:Parameter Name="RealHours" Type="Int32" />

<asp:Parameter Name="NumberArticles" Type="Int64" />

<asp:Parameter Name="EstimatedReadyDate" Type="DateTime" />

<asp:Parameter Name="Status_actief" Type="String" />

<asp:Parameter Name="DateSendDataSteward" Type="DateTime" />

<asp:Parameter Name="TaskId" />

</UpdateParameters>

<InsertParameters>

<%

--<asp:Parameter Name="ProjectId"

Type="Int32" />--

%>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32"/>

<asp:Parameter Name="BewerkingId" Type="Int32" />

<asp:Parameter Name="UserId" Type="Int32" />

<asp:Parameter Name="ReadyDate" Type="DateTime" />

<asp:Parameter Name="TaskDescription" Type="String" />

<asp:Parameter Name="Remarks" Type="String" />

<asp:Parameter Name="Date" Type="DateTime" />

<asp:Parameter Name="StartDate" Type="DateTime" />

<asp:Parameter Name="EstimatedHours" Type="Int32" />

<asp:Parameter Name="RealHours" Type="Int32" />

<asp:Parameter Name="NumberArticles" Type="Int64" />

<asp:Parameter Name="EstimatedReadyDate" Type="DateTime" />

<asp:Parameter Name="Status_actief" Type="String" />

<asp:Parameter Name="DateSendDataSteward" Type="DateTime" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsTaskList" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblBewerkingen]">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsFilesToTask" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [FilesPerTask] where TaskId = @TaskId">

<SelectParameters>

<asp:SessionParameter Name="TaskId" SessionField="TaskId" Type="Int32" Direction="Input"/>

</SelectParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsUsers" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblUsers]">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsCheckFile" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT tblFiles.FileId, tblFiles.FileName, FilesPerTask.FileId AS FileToTask, FilesPerTask.TaskId, tblFiles.ProjectId FROM tblFiles LEFT OUTER JOIN FilesPerTask ON tblFiles.FileId = FilesPerTask.FileId WHERE (tblFiles.ProjectId = @ProjectId)">

<SelectParameters>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>

</SelectParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsStatus" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblStatusTasks]">

</asp:SqlDataSource>

<asp:SqlDataSource ID="dsFileschk" runat="server"

ConnectionString="<%$ ConnectionStrings:DBPortal %>"

SelectCommand="SELECT * FROM [tblFiles] WHERE ([ProjectId] = @ProjectId)"

DeleteCommand="DELETE FROM [tblFiles] WHERE [FileId] = @original_FileId AND [ProjectId] = @original_ProjectId AND [FileName] = @original_FileName AND [FileSaveAs] = @original_FileSaveAs AND [DownloadDate] = @original_DownloadDate AND [FileDescription] = @original_FileDescription"

ConflictDetection="CompareAllValues"

InsertCommand="INSERT INTO [tblFiles] ([FileName], [FileSaveAs], [ProjectId], [DownloadDate], [FileDescription]) VALUES (@FileName, @FileSaveAs, @ProjectId, @DownloadDate, @FileDescription)"

OldValuesParameterFormatString="original_{0}"

UpdateCommand="UPDATE [tblFiles] SET [FileName] = @FileName, [FileSaveAs] = @FileSaveAs, [DownloadDate] = @DownloadDate, [FileDescription] = @FileDescription WHERE [FileId] = @original_FileId AND [ProjectId] = @original_ProjectId AND [FileName] = @original_FileName AND [FileSaveAs] = @original_FileSaveAs AND [DownloadDate] = @original_DownloadDate AND [FileDescription] = @original_FileDescription">

<%

-- <SelectParameters>

<asp:Parameter Name="ProjectId" Type="Int32" />

</SelectParameters>--

%>

<SelectParameters>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32" Direction="Input"/>

</SelectParameters>

<DeleteParameters>

<asp:Parameter Name="original_FileId" Type="Int32" />

<asp:Parameter Name="original_ProjectId" Type="Int32" />

<asp:Parameter Name="original_FileName" Type="String" />

<asp:Parameter Name="original_FileSaveAs" Type="String" />

<asp:Parameter Name="original_DownloadDate" Type="DateTime" />

<asp:Parameter Name="original_FileDescription" Type="String" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="FileName" Type="String" />

<asp:Parameter Name="FileSaveAs" Type="String" />

<asp:Parameter Name="DownloadDate" Type="DateTime" />

<asp:Parameter Name="FileDescription" Type="String" />

<asp:Parameter Name="original_FileId" Type="Int32" />

<asp:Parameter Name="original_ProjectId" Type="Int32" />

<asp:Parameter Name="original_FileName" Type="String" />

<asp:Parameter Name="original_FileSaveAs" Type="String" />

<asp:Parameter Name="original_DownloadDate" Type="DateTime" />

<asp:Parameter Name="original_FileDescription" Type="String" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="FileName" Type="String" />

<asp:Parameter Name="FileSaveAs" Type="String" />

<%

-- <asp:Parameter Name="ProjectId" Type="Int32" />--%>

<asp:SessionParameter Name="ProjectId" SessionField="ProjectId" Type="Int32"/>

<asp:Parameter Name="DownloadDate" Type="DateTime" />

<asp:Parameter Name="FileDescription" Type="String" />

</InsertParameters>

</asp:SqlDataSource>

</form>

</

body>

0
Veli
Telerik team
answered on 16 Jul 2008, 08:39 AM
Hello A.,

Could you try setting a DataField property to the GridTemplateColumn that you define your checkboxlist in:

DataField="FileName"

Greetings,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mydatafactory
Top achievements
Rank 1
answered on 16 Jul 2008, 08:55 AM
Hello Veli,

Unfortunately, this doesn't solve the problem as well. I tried to use FileId and FilenName as DataField in GridTemplateColumn:

<telerik:GridTemplateColumn UniqueName="TempCol" DataField="FileName">
0
Veli
Telerik team
answered on 16 Jul 2008, 12:30 PM
Hi A.,

Please find attached a sample project I have created for your reference. There is a GridTemplateColumn inside RadGrid with a CheckBoxList in the EditTemplate. The CheckBoxList is binding as expected to a second data source and referenced in the ItemDataBound event of RadGrid to set the checked item corresponding to the current value in the data field.

Please see how this relates to your case.

Regards,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mydatafactory
Top achievements
Rank 1
answered on 19 Aug 2008, 08:15 AM
Hello,

I was on a holiday for a few weeks, but now I'm back.

I used the code of the sample-project, but I had to changed it a little bit.
What I want is: to set the checked item NOT orresponding to the current value in the data field.

Unfortunately, the changes I made to the code didn't make a difference.



0
Veli
Telerik team
answered on 25 Aug 2008, 07:39 AM
Hello A.,

Inside the ItemDataBound event of your RadGrid, you can check an arbitrary item from your checkbox list based on your custom criteria. Please specify what do you need to do and why it does not work out for you.

Best wishes,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Mydatafactory
Top achievements
Rank 1
Answers by
Veli
Telerik team
Mydatafactory
Top achievements
Rank 1
Share this question
or