I need to know how can i store RadioButtonList
items into my SQL db, already have this for TextBoxes:
public class Botones
{
public void SaveCVInfo2(string varOne,string varTwo, string varThree)
{
using (ConexionGeneralDataContext db = new ConexionGeneralDataContext())
{
Usuario_Web columna = new Usuario_Web();
//Add new values to each fields
columna.Nombre = varOne;
columna.Apellido = varTwo;
columna.Em_solicitado = varThree;
//and the rest where the textboxes would have been
//Insert the new Customer object
db.Usuario_Web.InsertOnSubmit(columna);
//Sumbit changes to the database
db.SubmitChanges();
}
}
}
Then reference them like this:
protected void Button1_Click(object sender, EventArgs e)
{
Botones botones = new Botones();
botones.SaveCVInfo2(nombre.Text, Apellidos.Text, EmpleoS.Text);
}
I need to know a way to add to the columna
data from Radio Buttons in asp.net, while keeping this format of communication with the db.
BTW i have varchar
tables for RadioButtonList data in my db.
I searched for some tutorials, but only found some old fashioned ADO connections examples, and i'm using Linq to SQL here.
This is a RadioButtonList I'm using in my aspx
page:
<asp:RadioButtonList ID="RadioButtonList6" RepeatColumns = "2" RepeatDirection="Vertical" RepeatLayout="Table" runat="server">
<asp:ListItem ValidationGroup="Curriculum" style="margin-right:12px; margin-top:-10px" >Si</asp:ListItem>
<asp:ListItem ValidationGroup="Curriculum" >No</asp:ListItem>
</asp:RadioButtonList>
Alright, i solved it like this.
In my class:
using System.Xml.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Net.Mail;
namespace Grupo_Zulcon
{
public partial class EnvianosTuCurriculum : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Botones botones = new Botones();
botones.SaveCVInfo2(nombre.Text, Apellidos.Text, EmpleoS.Text, DireccionPersonal.Text, RadioButtonList6.SelectedItem.Text);
}
}
}
And in aspx.cs codebehind file:
protected void Button1_Click(object sender, EventArgs e)
{
Botones botones = new Botones();
botones.SaveCVInfo2(nombre.Text, Apellidos.Text, EmpleoS.Text, DireccionPersonal.Text, RadioButtonList6.SelectedItem.Text);
}
For anyone who might need it, thx.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.