Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Allow data input

Posted on 2013-01-14
5
Medium Priority
?
309 Views
Last Modified: 2013-01-23
Hi,
I defined a "Formview" on the page like the following. How to allow data insert when there is no records?
    ...
    <asp:FormView ID="lan_gv" runat="server"
    AutoGenerateColumns="false"
    HeaderStyle-BorderStyle="Double"
    BorderWidth="2px"
    Font-Size="Small"
    ForeColor="DarkBlue"
    BackColor="#1BE0D6"
    BorderStyle="Groove"
    AllowSorting="True"
    Title="Test"
    datasourceid="ds_int" >
    <EmptyDataTemplate>
    <asp:Image ID="im1" AlternateText="No Data" runat="server" />
    </EmptyDataTemplate>
    <HeaderStyle BackColor="#1BE0D6">
    </HeaderStyle>
    <EditItemTemplate>
    <asp:DropDownList ID="int_list"
        runat="server"
        BackColor="#1BE0D6"
        DataTextField="Language"
        DataValueField="language" >
    </asp:DropDownList>
    <asp:Textbox id="change_date" Text='<%# Bind("change_date") %>' runat="server" />
    </EditItemTemplate>
    </asp:FormView>
    ...
0
Comment
Question by:HuaMinChen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 38777311
here you will get example of how to insert data using formview

http://sfvt.wordpress.com/2010/09/06/asp-net-tutorial-formview-insert-to-database/
0
 
LVL 11

Author Comment

by:HuaMinChen
ID: 38777321
Thanks. But what change needs to be applied to the above codes to make data insert available to the user doing the input?
0
 
LVL 11

Author Comment

by:HuaMinChen
ID: 38781275
Any help?
0
 
LVL 16

Assisted Solution

by:Rose Babu
Rose Babu earned 800 total points
ID: 38792962
can you check the below tutorial to edit/update/insert data from FormView as you need

http://www.dotnetfunda.com/articles/article991-formview-in-edit-insert-readonly-mode.aspx
0
 
LVL 10

Accepted Solution

by:
Monica P earned 1200 total points
ID: 38799904
Hi..

You can change the FormViewMode to insert if there is no record from your datasource.
<asp:FormView ID="FormView1" runat="server" OnDataBound="FormView1_OnDataBound" >

protected void FormView1_OnDataBound(object sender, EventArgs e)
    {
        if (FormView1.PageCount == 0)
        {
            FormView1.ChangeMode(FormViewMode.Insert);

        }
      }

To get more info
********************
Have look on this article for Insert update and delete

http://www.c-sharpcorner.com/blogs/7227/insert-update-and-delete-using-a-formview.aspx
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question