Search code examples
c#.netasp.netformview

Formview Insert Mode


i am using formview and sqldatasouce. every thing is fine but when i have no record in my table nothing(no formview) is shown on the page. I want that when my table has no record then formview should be shown but in Insert Mode.

can any body help me to resolve this?

thanks in advance


Solution

  • It should be like...

    if (!Page.IsPostBack)
        {
            if (FormView1.DataItemCount == 0)
            {
                FormView1.ChangeMode(FormViewMode.Insert);
            }
        }