Sunday, 25 November 2012

.csPage

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data;


public partial class Registreation : System.Web.UI.Page
{
    Runtype run = new Runtype();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //GetDataItem();
            //id = Convert.ToInt32(Page.Request.QueryString["id"]);


            //if (id > 0)
            //{
            //    DataSet Ds = new DataSet();
            //    Ds = run.GetDataByRecid(id);
            //    TextBox1.Text = Ds.Tables[0].Rows[0]["Title"].ToString();
            //    TextBox2.Text = Ds.Tables[0].Rows[0]["Firstname"].ToString();
            //    TextBox3.Text = Ds.Tables[0].Rows[0]["MiddleName"].ToString();
            //}


        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
      

        putdata();
        FileUpload img = (FileUpload)imgUpload;
        Byte[] imgByte = null;
        if (img.HasFile && img.PostedFile != null)
        {
            //To create a PostedFile
            HttpPostedFile File = imgUpload.PostedFile;
            //Create byte Array with file len
            imgByte = new Byte[File.ContentLength];
            //force the control to load data in array
            File.InputStream.Read(imgByte, 0, File.ContentLength);
        }
        byte[] d = imgByte;

        Savedata(run.regtable, d);

      
      
    }
    public void Savedata(DataTable dt,byte[] t)
    {
        DataSet Ds = new DataSet();
        Ds.Tables.Add(dt);
        run.SaveimageRecord(Ds,t);
    }
   
    public void putdata()

    {
       
        run.intiregtable();
        run.regtable.Rows[0]["name"] = TextBox4.Text;
        run.regtable.Rows[0]["loginid"] = TextBox3.Text;
        run.regtable.Rows[0]["Emailid"] = txtEmail.Text;
        run.regtable.Rows[0]["phoneno"] = TextBox1.Text;
        run.regtable.Rows[0]["services"] = TextBox1.Text;
        //run.regtable.Rows[0]["photo"] = imgByte;
        run.regtable.Rows[0]["dob"] = TxtDate.Text;
    }
 
}

No comments:

Post a Comment