hi all

add button coding

rec.Gender = gender.SelectedValue.ToString();
rec.Martial_status= martial.SelectedValue.ToString();

when i run the code
the following error occur in gender

Object reference not set to an instance of an object

May be the reference variable rec contains null or gender.SelectedValue or martial.SelectedValue returns null.

Please add a break-point at these lines and verify the value of reference variables/properties.

is rec instanciated ?

Please provide more of the code, if not all of it.

Usually when you see something like this it means you didn't do like
"rec = new Button()" or something like that (this is an example ... not saying do exactly do this).

But again providing more of your code might be able to allow us to help you more

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.