how to make message appear after record is inserted?

Discussion in 'ASP .Net Web Controls' started by Jan, Mar 7, 2007.

  1. Jan

    Jan Guest

    Hello,

    Just after the new record is inserted in the database using a Detailsview
    control, i would like to display a short message "the record is inserted".
    In the aspx file, i defined a hiddenfiekd:
    <asp:HiddenField ID="HiddenField1" runat="server" Visible="false" />

    In the code-behind:
    Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles
    DetailsView1.ItemInserted
    HiddenField1.Visible = True
    HiddenField1.Value = "record inserted"
    End Sub


    My problem is that nothing appears. It's due to the automatic postback, i
    think. Any way to make the message visible?

    Thanks
    Jan
    Jan, Mar 7, 2007
    #1
    1. Advertising

  2. Jan

    David Wier Guest

    Try using a label instead of a hiddenfield control

    --
    David Wier
    MVP/ASPInsider
    http://aspnet101.com
    http://aspexpress.com



    "Jan" <cbcbc@xcvx> wrote in message
    news:%...
    > Hello,
    >
    > Just after the new record is inserted in the database using a Detailsview
    > control, i would like to display a short message "the record is inserted".
    > In the aspx file, i defined a hiddenfiekd:
    > <asp:HiddenField ID="HiddenField1" runat="server" Visible="false" />
    >
    > In the code-behind:
    > Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As
    > System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles
    > DetailsView1.ItemInserted
    > HiddenField1.Visible = True
    > HiddenField1.Value = "record inserted"
    > End Sub
    >
    >
    > My problem is that nothing appears. It's due to the automatic postback, i
    > think. Any way to make the message visible?
    >
    > Thanks
    > Jan
    >
    >
    David Wier, Mar 7, 2007
    #2
    1. Advertising

  3. Jan

    Scott M. Guest

    A hidden form field can never be visible (hence its name). Use a label
    control.


    "David Wier" <> wrote in message
    news:...
    > Try using a label instead of a hiddenfield control
    >
    > --
    > David Wier
    > MVP/ASPInsider
    > http://aspnet101.com
    > http://aspexpress.com
    >
    >
    >
    > "Jan" <cbcbc@xcvx> wrote in message
    > news:%...
    >> Hello,
    >>
    >> Just after the new record is inserted in the database using a Detailsview
    >> control, i would like to display a short message "the record is
    >> inserted".
    >> In the aspx file, i defined a hiddenfiekd:
    >> <asp:HiddenField ID="HiddenField1" runat="server" Visible="false" />
    >>
    >> In the code-behind:
    >> Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e
    >> As
    >> System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles
    >> DetailsView1.ItemInserted
    >> HiddenField1.Visible = True
    >> HiddenField1.Value = "record inserted"
    >> End Sub
    >>
    >>
    >> My problem is that nothing appears. It's due to the automatic postback, i
    >> think. Any way to make the message visible?
    >>
    >> Thanks
    >> Jan
    >>
    >>

    >
    >
    Scott M., Mar 7, 2007
    #3
  4. Jan

    Jan Guest

    Yes, this works.Thanks.
    Is there any explanation why it doesn't with a hiddenfield?



    "David Wier" <> schreef in bericht
    news:...
    > Try using a label instead of a hiddenfield control
    >
    > --
    > David Wier
    > MVP/ASPInsider
    > http://aspnet101.com
    > http://aspexpress.com
    >
    >
    >
    > "Jan" <cbcbc@xcvx> wrote in message
    > news:%...
    >> Hello,
    >>
    >> Just after the new record is inserted in the database using a Detailsview
    >> control, i would like to display a short message "the record is
    >> inserted".
    >> In the aspx file, i defined a hiddenfiekd:
    >> <asp:HiddenField ID="HiddenField1" runat="server" Visible="false" />
    >>
    >> In the code-behind:
    >> Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e
    >> As
    >> System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles
    >> DetailsView1.ItemInserted
    >> HiddenField1.Visible = True
    >> HiddenField1.Value = "record inserted"
    >> End Sub
    >>
    >>
    >> My problem is that nothing appears. It's due to the automatic postback, i
    >> think. Any way to make the message visible?
    >>
    >> Thanks
    >> Jan
    >>
    >>

    >
    >
    Jan, Mar 7, 2007
    #4
  5. Jan

    Bob Lehmann Guest

    >> Is there any explanation why it doesn't with a hiddenfield?
    Because it's hidden.

    Bob Lehmann

    "Jan" <cbcbc@xcvx> wrote in message
    news:...
    > Yes, this works.Thanks.
    > Is there any explanation why it doesn't with a hiddenfield?
    >
    >
    >
    > "David Wier" <> schreef in bericht
    > news:...
    > > Try using a label instead of a hiddenfield control
    > >
    > > --
    > > David Wier
    > > MVP/ASPInsider
    > > http://aspnet101.com
    > > http://aspexpress.com
    > >
    > >
    > >
    > > "Jan" <cbcbc@xcvx> wrote in message
    > > news:%...
    > >> Hello,
    > >>
    > >> Just after the new record is inserted in the database using a

    Detailsview
    > >> control, i would like to display a short message "the record is
    > >> inserted".
    > >> In the aspx file, i defined a hiddenfiekd:
    > >> <asp:HiddenField ID="HiddenField1" runat="server" Visible="false" />
    > >>
    > >> In the code-behind:
    > >> Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e
    > >> As
    > >> System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles
    > >> DetailsView1.ItemInserted
    > >> HiddenField1.Visible = True
    > >> HiddenField1.Value = "record inserted"
    > >> End Sub
    > >>
    > >>
    > >> My problem is that nothing appears. It's due to the automatic postback,

    i
    > >> think. Any way to make the message visible?
    > >>
    > >> Thanks
    > >> Jan
    > >>
    > >>

    > >
    > >

    >
    >
    Bob Lehmann, Mar 7, 2007
    #5
  6. Jan

    Jan Guest

    Of course ...
    Thanks to all

    "Bob Lehmann" <> schreef in bericht
    news:...
    >>> Is there any explanation why it doesn't with a hiddenfield?

    > Because it's hidden.
    >
    > Bob Lehmann
    >
    > "Jan" <cbcbc@xcvx> wrote in message
    > news:...
    >> Yes, this works.Thanks.
    >> Is there any explanation why it doesn't with a hiddenfield?
    >>
    >>
    >>
    >> "David Wier" <> schreef in bericht
    >> news:...
    >> > Try using a label instead of a hiddenfield control
    >> >
    >> > --
    >> > David Wier
    >> > MVP/ASPInsider
    >> > http://aspnet101.com
    >> > http://aspexpress.com
    >> >
    >> >
    >> >
    >> > "Jan" <cbcbc@xcvx> wrote in message
    >> > news:%...
    >> >> Hello,
    >> >>
    >> >> Just after the new record is inserted in the database using a

    > Detailsview
    >> >> control, i would like to display a short message "the record is
    >> >> inserted".
    >> >> In the aspx file, i defined a hiddenfiekd:
    >> >> <asp:HiddenField ID="HiddenField1" runat="server" Visible="false" />
    >> >>
    >> >> In the code-behind:
    >> >> Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal
    >> >> e
    >> >> As
    >> >> System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles
    >> >> DetailsView1.ItemInserted
    >> >> HiddenField1.Visible = True
    >> >> HiddenField1.Value = "record inserted"
    >> >> End Sub
    >> >>
    >> >>
    >> >> My problem is that nothing appears. It's due to the automatic
    >> >> postback,

    > i
    >> >> think. Any way to make the message visible?
    >> >>
    >> >> Thanks
    >> >> Jan
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >
    Jan, Mar 8, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig
    Replies:
    1
    Views:
    1,877
    =?Utf-8?B?SmFtZXM=?=
    Jan 25, 2006
  2. Jan
    Replies:
    5
    Views:
    1,123
  3. shapper
    Replies:
    0
    Views:
    682
    shapper
    Feb 12, 2008
  4. fig000
    Replies:
    0
    Views:
    612
    fig000
    Sep 6, 2008
  5. Bobby Edward
    Replies:
    2
    Views:
    3,037
    Bobby Edward
    Oct 5, 2008
Loading...

Share This Page