2013-10-13 2 views
0

мне нужно знать, как я могу хранить RadioButtonList элементы в моей SQL дб, уже есть это для TextBoxes:Как хранить в БД RadioButtonList

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(); 
    } 

} 
} 

Затем ссылаться на них, как это:

protected void Button1_Click(object sender, EventArgs e) 
    { 
     Botones botones = new Botones(); 
     botones.SaveCVInfo2(nombre.Text, Apellidos.Text, EmpleoS.Text); 
    } 

Мне нужно знать способ добавления к columna данных с радиоустройств в asp.net, сохраняя этот формат связи с db.

BTW У меня есть varchar таблицы для данных RadioButtonList в моем db.

Я искал некоторые обучающие программы, но нашел только примеры старинного подключения ADO, и я использую Linq для SQL здесь.

Это RadioButtonList я использую в моей aspx странице:

<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> 
+0

Я отредактировал ваше название. Пожалуйста, смотрите: «Если вопросы включают« теги »в их названиях?] (Http://meta.stackexchange.com/questions/19190/), где консенсус« нет, они не должны ». –

+0

Спасибо, я также опубликую свое решение. – NeoVe

ответ

0

Хорошо, я решил это так.

В моем классе:

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); 
    } 

} 
} 

И в aspx.cs файле отделенного кода:

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); 
    } 

Для тех, кто может понадобиться, ТНХ.

Смежные вопросы