views:

12

answers:

0

I have a checkbox that allows users to keep the input in a detailsview to help if they are inputting many similair items. I'd like one field to increment, but it won't take. I've even tried putting it in a hidden field. Incrementing field:

Protected Sub DetailsView3_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles DetailsView3.ItemInserted
    If (multipleEntryCheck.Checked) Then
        e.KeepInInsertMode = True
        Dim x As Integer
        x = Integer.Parse(e.Values("ISTag").ToString.Substring(2, 4))
        x += 1
        e.Values("ISTag") = "IS" & x.ToString
        ISTagKeeper.Value = "IS" & x.ToString
        eInsertArgs = e
        eInsertArgs.Values("ISTag") = "IS" & x.ToString
    End If
    'addButton_Click(sender, System.EventArgs.Empty)
End Sub

Here is where I set the values back to what they were:

Protected Sub DetailsView3_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView3.DataBinding
    If IsNothing(eInsertArgs) = False Then
        eInsertArgs.Values("ISTag") = ISTagKeeper.Value.ToString
        Dim _sender As TextBox = sender
        _sender.Text = eInsertArgs.Values("_FieldName")
    End If
End Sub