By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,913 Members | 1,379 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,913 IT Pros & Developers. It's quick & easy.

How to assign Imagebox image to Entity object for Saving in Database.

P: 45
Hi,
i have successfully able to load Image to imagebox in my Silverlight Application.Now i want to assign that selected image to the object that is carrying data to Service file to save records.
Below is my Code.
Code for how im Browsing n selecting Image.
Expand|Select|Wrap|Line Numbers
  1.  private void btnBrowse_Click(object sender, RoutedEventArgs e)
  2.         {
  3. OpenFileDialog objFileDialog = new OpenFileDialog();
  4.             bool? IsSelected = objFileDialog.ShowDialog();
  5.             objFileDialog.Filter = "Pictures (*.jpg)|*.jpg";
  6.             objFileDialog.FilterIndex = 1;
  7.             if (IsSelected == true)
  8.             {
  9.  
  10.                 BitmapImage bitImage = new BitmapImage();
  11.                 bitImage.SetSource(objFileDialog.File.OpenRead());
  12.                 image1.Source = bitImage;
  13.                 //Image1 is object of Image
  14.             }  
  15. }
  16. Code of Object that is carrying Data to Save Method in Service File.
  17. private void btnSave_Click(object sender, RoutedEventArgs e)
  18.         {
  19.  
  20. var objAlumni = new ServiceReference1.Alumni_Registration();
  21.   objAlumni.AY_ID = newAcadYearId;
  22.   objAlumni.CellNo = txtCellNo.Text;
  23.   objAlumni.ImageId = ;
  24.   services.AlumniRegAsync(objAlumni);
  25. }
  26.  
Please suggest how should i assign my Selected Image to object objAlumni
Aug 25 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.