Home » .NET 4.0 » DefaultValue of parameter – alternative method of setting parameter’s value

DefaultValue of parameter – alternative method of setting parameter’s value

Set update parameter default value in code behind:

Formview

....
Meeting Time: 
<asp:textbox ID="TimeTextBox" runat="server" Text='< %# Bind("Time") %>' />
...
<updateparameters>
    <asp:parameter Name="Time" Type="String" />
    <asp:parameter Name="Rid" Type="Int32" />
</updateparameters>
</asp:textbox>
Code behind

Protected Sub MemberDetailFV_ItemUpdating(ByVal sender As Object, ByVal_
  e As System.Web.UI.WebControls.FormViewUpdateEventArgs)_ 
  Handles MemberDetailFV.ItemUpdating_
  MemberDetailDS.UpdateParameters("Time").DefaultValue = Now()
End Sub