Click here to Skip to main content
13,052,669 members (62,415 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I am doing school software project in windows application.in student marksheet loading
form i want to load the all the student marks for particular class at one instant
i am using datagrid to get the student name and subject.now i want to enter the
student marks within the datagrid and calculate the total and average.i don't know
how to enter the values dynamically in datagrid and insert it into the database.

i am using sqlserver 2005 as backend

if anyone have an idea share with me with some example code or link.
Posted 8-Mar-12 23:18pm
Comments
Oshtri Deka 9-Mar-12 5:22am
   
Have you written any code?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Here is the sample code

Data to be embedded in a row is defined in the class 'Data'
public class Data
{
    public string Name { get; set; }
}


XAML front end code will be:
<UserControl .... xmlns:my="clr-namespace:System.Windows.Controls; assembly=System.Windows.Controls.Data>...
<my:DataGrid x:Name="dg" AutoGenerateColumns="True"></my:DataGrid>
<TextBox x:Name="Nametxt" />
<Button Content="Add" Click="Btn_click"/>


Code behind C# is
List<data> source = new List<data>();
dg.ItemsSource = source;
 
void Btn_Click(...)
{
        source.Add(new Data()
        { 
            Name = Nametxt.Text.Trim();
        });
}</data></data>
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You should do a bit of research before posting a question.
See
this,
this,
this,
or just use search option or google it!

Learning is a process, shortcuts aren't always best solution.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 9 Mar 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100