How to use FormView in

Total Post:341

C#  ASP.Net 
 962  View(s)
Rate this:
i want to use formView in please help me .
  1. Post:282

    Re: How to use FormView in

    The FormView control is used to display a single record from a data source in a table.
    It is Server Side Control in

    <asp:FormView ID="FormView1" runat="server" GridLines="Horizontal">


    <div style="background-color: #BBB138;font-size: 15px;font-weight: bold;padding: 10px;">Employee Details</div>



    <div style="background-color:#efb558; padding:20px;">

    <div style="padding-left: 10px;">

    ID: <%#Eval("Emp_ID") %>


    <div style="padding-left: 10px;">

    Name: <%#Eval("Emp_Name") %>


    <div style="padding-left: 10px;">

    Salary: <%#Eval("Emp_Sal") %>





    string constr = ConfigurationManager.ConnectionStrings["forumConnectionString"].ToString(); // connection string

    SqlConnection con = new SqlConnection(constr);  


    SqlCommand com = new SqlCommand("select *from Employee", con); // table name

    SqlDataAdapter da = new SqlDataAdapter(com);

    DataSet ds = new DataSet();

    da.Fill(ds); // fill dataset

    FormView1.DataSource = ds.Tables[0]; //set DataSource FormView

    FormView1.DataBind(); //binding FormView 





      Modified On Apr-10-2018 05:08:06 AM