Reputation: 7542
I am using a SelectParameters and DeleteParameters:
<SelectParameters>
<asp:QueryStringParameter Name="userIdSelected" Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:QueryStringParameter Name="test" Type="String" />
</DeleteParameters>
The following C# code works fine to assign a string to the parameter:
SqlDataSource4.SelectParameters["userIdSelected"].DefaultValue = "test";
But for my delete parameter it is not working:
SqlDataSource4.SelectParameters["test"].DefaultValue = "test";
I am getting the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
What am I doing wrong?
Upvotes: 1
Views: 325
Reputation: 7147
You are still referencing the SelectParameters. Change it to this:
SqlDataSource4.DeleteParameters["test"].DefaultValue = "test";
Upvotes: 1