Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Comments
Oshtri Deka 9-Mar-12 5:22am    
Have you written any code?

Here is the sample code

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


XAML front end code will be:
XML
<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
C#
List<data> source = new List<data>();
dg.ItemsSource = source;

void Btn_Click(...)
{
        source.Add(new Data()
        { 
            Name = Nametxt.Text.Trim();
        });
}</data></data>
 
Share this answer
 
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900