I have placed a delete button in the ItemTemplate section and the AlternatingItemTemplate area. When I try and click on the button, I get the following message
I have an update button in the same line and it seems to work correctly. here is my datasource code....
and here is my ItemTemplate
Any ideas or Suggestions?
You have specified that your delete command compares all values on SqlDataSource 'dsLTDist0', but the dictionary passed in for values is empty. Pass in a valid dictionary for delete or change your mode to OverwriteChanges
I have an update button in the same line and it seems to work correctly. here is my datasource code....
<
asp:SqlDataSource
ID
=
"dsLTDist0"
runat
=
"server"
ConflictDetection
=
"CompareAllValues"
ConnectionString="<%$ ConnectionStrings:Tech-InnovationsConnectionString %>"
DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @original_ID"
InsertCommand="INSERT INTO [Appointments] ([Subject], [Unit], [Area], [Vehicle], [Status], [Hours], [Comments],[Start],[End],[District]) VALUES (@Subject, @Unit, @Area, @Vehicle, @Status, @Hours, @Comments,@Start,@End,@District)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT [ID], [Subject], [Unit], [Area], [Vehicle], [Status], [Hours], [Comments] FROM [Appointments]"
UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Unit] = @Unit, [Area] = @Area, [Vehicle] = @Vehicle, [Status] = @Status, [Hours] = @Hours, [Comments] = @Comments WHERE [ID] = @original_ID AND [Subject] = @original_Subject AND (([Unit] = @original_Unit) OR ([Unit] IS NULL AND @original_Unit IS NULL)) AND (([Area] = @original_Area) OR ([Area] IS NULL AND @original_Area IS NULL)) AND (([Vehicle] = @original_Vehicle) OR ([Vehicle] IS NULL AND @original_Vehicle IS NULL)) AND (([Status] = @original_Status) OR ([Status] IS NULL AND @original_Status IS NULL)) AND (([Hours] = @original_Hours) OR ([Hours] IS NULL AND @original_Hours IS NULL)) AND (([Comments] = @original_Comments) OR ([Comments] IS NULL AND @original_Comments IS NULL))">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"original_ID"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Unit"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Area"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Vehicle"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Status"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Hours"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Comments"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Start"
Type
=
"datetime"
/>
<
asp:Parameter
Name
=
"End"
Type
=
"datetime"
/>
<
asp:Parameter
Name
=
"District"
Type
=
"int32"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Unit"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Area"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Vehicle"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Status"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Hours"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Comments"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_ID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Unit"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Area"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Vehicle"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Status"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Hours"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Comments"
Type
=
"String"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
and here is my ItemTemplate
<
ItemTemplate
>
<
tr
class
=
"rlvI"
>
<
td
>
<
asp:Button
ID
=
"EditButton"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Edit"
CssClass
=
"rlvBEdit"
Text
=
" "
ToolTip
=
"Edit"
/>
</
td
>
<
td
>
<
asp:Label
ID
=
"SubjectLabel"
runat
=
"server"
width
=
"170"
Text='<%# Eval("Subject") %>' />
</
td
>
<
td
>
<
asp:Label
ID
=
"UnitLabel"
runat
=
"server"
width
=
"70"
Text='<%# Eval("Unit") %>' />
</
td
>
<
td
>
<
asp:Label
ID
=
"AreaLabel"
runat
=
"server"
width
=
"70"
Text='<%# Eval("Area") %>' />
</
td
>
<
td
>
<
asp:Label
ID
=
"VehicleLabel"
runat
=
"server"
width
=
"70"
Text='<%# Eval("Vehicle") %>' />
</
td
>
<
td
>
<
asp:Label
ID
=
"HoursLabel"
runat
=
"server"
width
=
"80"
Text='<%# Eval("Hours") %>' />
</
td
>
<
td
>
<
asp:Label
ID
=
"StatusLabel"
runat
=
"server"
width
=
"100"
Text='<%# Eval("Status") %>' />
</
td
>
<
td
>
<
asp:Label
ID
=
"CommentsLabel"
runat
=
"server"
width
=
"200"
Text='<%# Eval("Comments") %>' />
</
td
>
<
td
>
<
asp:Button
ID
=
"btnDel"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Delete"
CssClass
=
"rlvBDel"
Text
=
" "
ToolTip
=
"Delete this Record"
/>
</
td
>
</
tr
>
</
ItemTemplate
>
Any ideas or Suggestions?