How To Insert Multiple Radiobuttonlist Value In One Column In Database
Jan 28, 2011
I am using c#.net.I have 5 radiobuttonlist and 5 checkbbox list i want to insert all selected value in one column of the database to gentrate the record and show the customer that your record number is this and also want to compare with selected value with the other database calculate the price of the secleted parts and save it with the record.
View 8 Replies
Similar Messages:
Aug 4, 2010
i use this to select one checkbox to isselected column how i convert this to multi checkboxlist to single column i use many ways more than 3 days without success
private void BindCheckBoxList()
{
DataTable dt = new DataTable();
SqlConnection connection = new SqlConnection(GetConnectionString());
try
{
connection.Open();
string sqlStatement = "SELECT * FROM boby";
SqlCommand sqlCmd = new SqlCommand(sqlStatement, connection);
SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
sqlDa.Fill(dt);
if (dt.Rows.Count > 0)
{
CheckBoxList1.RepeatColumns = 4; // set the number of columns in the CheckBoxList
CheckBoxList1.DataSource = dt;
CheckBoxList1.DataTextField = "Name"; // the items to be displayed in the list items
CheckBoxList1.DataValueField = "Name"; // the id of the items displayed
CheckBoxList1.DataBind();
//Setting the Selected Items in the ChecBoxList based from the value in the database
//to do this, lets iterate to each items in the list
for (int i = 0; i < dt.Rows.Count; i++)
{
if (!string.IsNullOrEmpty(dt.Rows[i]["IsSelected"].ToString()))
{
CheckBoxList1.Items[i].Selected = Convert.ToBoolean(dt.Rows[i]["IsSelected"]);
}
}
}
}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Fetch Error:";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
connection.Close();
}
}
private void Update(string name, bool isSelected)
{
SqlConnection connection = new SqlConnection(GetConnectionString());
SqlCommand cmd;
string sqlStatement = string.Empty;
try
{
connection.Open();
sqlStatement = "UPDATE handymen SET IsSelected = @IsSelected WHERE Name = @BizName";
cmd = new SqlCommand(sqlStatement, connection);
cmd.Parameters.AddWithValue("@Name", name);
cmd.Parameters.AddWithValue("@IsSelected", isSelected);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Insert/Update error";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
connection.Close();
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindCheckBoxList();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string str = string.Empty;
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Selected)
{
str = CheckBoxList1.Items[i].Text;
Update(str, CheckBoxList1.Items[i].Selected);
}
}
//ReBind the List to retain the selected items on postbacks
BindCheckBoxList();
}
View 3 Replies
Aug 20, 2010
i need to insert multiple rows at a time into database table(sqlserver) from datatable or gridview. Actually iam looping through the rows of gridview and inserting each row. Is there any method to insert entire table of rows at a time into database table. Both datatable columns and database table coulmns are similar.
View 2 Replies
Oct 19, 2010
I have grid view in ASP.Net 3.5. I need to add multiple blank rows in a gridview and then have to save them in database. How can I do that in most simplest way?
View 7 Replies
Feb 2, 2011
I have a radiobuttonlist inside a datalist itemtemplate and i need to bind the radiobuttonlist dynamically from database I have tried to bind it inside itemdatabound event of datalist but it the result is always duplicated according to the fields in teh database.
for more information:
the database has two columns one for questions and the other is for choices , for the first question with id lets say 1 there are 4 choices, when the radiobutton is binded the result appears to be 4 times duplicated ?
View 1 Replies
Mar 13, 2010
Not sure if this should be in SQL or .NET but as I'm doing this in asp.net I figured here..I'm trying to insert '00' into a varchar column of my database, when I do this its actually in the database as '0'... if I do '05' or '15' or '30' then its fine.
View 5 Replies
Dec 21, 2010
i have created a web form, where i have 3 textboxes into a table and one submit button.
i would like to store values from the textboxes into my database (sql server) when i click the submit button.
but how to insert the value that is not in textbox into database which is primary key for table without identity column.
View 11 Replies
Jun 16, 2015
How should i insert null values into a database. I have textbox1 and the textbox2 will convert the value out of textbox1, when i the time i click save and the textbox1 is empty i got an error, "Conversion from string "" to type 'Date' is not valid." i just want to insert null value if the textbox is empty.
View 1 Replies
May 19, 2010
I have a text file.I need to get data from this text file and show on grid ,1)After this user can update information from gridview, 2)Click on save button save data on database.Before clicking on button data don't save on database.How to do that?
View 1 Replies
Jul 15, 2010
I would like to know if someone can please help me with the followingI would like to create a bulk entering textbox...every sentence seperated by a line break should go in to the Database as a new column.....Im gonna use SqlDatasource for the inserting..How can I get all the sentences to break up at the linebreak and then get inserted in a separate database column?
View 3 Replies
May 22, 2010
I have Gridview on my webapplication and it is getting filled with multiple rows . When clicked on Save I want to Insert all rows without calling multiple database hits.
Is there any way I can insert all rows by single db hit?
View 15 Replies
May 19, 2010
I want to insert almost 400 rows in one database call in asp.net. I am using .net 3.5 and sql server 2005. What should be the best possible way for doing that?.
View 1 Replies
Jul 17, 2013
I have a save button outside the gridview and I want to save all the values/records of gridview at once or row by row in database(sql server) .
View 1 Replies
May 7, 2015
i am try this code for multipul image upload in database
but only one image store in database at a time
protected void Button1_Click(object sender, EventArgs e)
{
if (file.HasFile == false)
[Code].....
View 1 Replies
Aug 7, 2013
I have a save boutton outside the listview and i want to save all the value records of listview at once or row by row in databace (sql server).
View 1 Replies
May 7, 2015
Save (Insert) values of multiple CheckBoxes to database in ASP.Net
View 1 Replies
Feb 19, 2010
[code]....
I am having Table called Interest and has only one column named Answer...
i want the checked values to insert in database..If i select Family, News and Fashion... The inserted data should be in Three rows of answer field..
View 3 Replies
Dec 30, 2010
i have textbox1 and textbox2 and 8 checkboxes in my ASP.NET (VB.NET) webform. i want to retrieve the seats on the particular dates means if i enter 11/12/2010 in textbox1 then in textbox2 the output would be from seat_select column, let say (1,2,3) where date would be 11/12/2010 If i enter 13/12/2010 in textbox1 then in textbox2 the output would be 1,2
View 3 Replies
Jun 3, 2010
I want to retrieve data from various column,which may some have blank value, so my problem is i want to retrieve only filled column(not any blank column) from multiple column.. I am doing this (given below) but it didn't return anything...
Column Name Value
Restaurant Restaurant
Spa Spa
Parking
Bar_Pub
Fitness_Center_Gym Fitness_Center_Gym
OleDbCommand cmd1 = new OleDbCommand("select nID Restaurant+''+Spa+''+Parking+''+Bar_Pub+''+Fitness_Center_Gym AS Facility from add_property where ncity='" + DropDownList1.SelectedItem.Text + "'", con);
DropDownList2.DataValueField = "nID";
DropDownList2.DataTextField = "Facility";
DropDownList2.DataBind();
con.Close();
--------------------------------------
View 9 Replies
May 7, 2015
i am devalope one webpage it contain one textbox and two listboxes in that user can enter textbox value and select multipule selected values fromlistbox in that how to store database values into one record (i.e database contain 3cloumns in that store in column1:20(textbox value) and clomun2:4,3,5(selected listbox values ) and column3:4,5(selected listbox values)).in that i am using wcf service for inserting method how to pass multipule selected values into services in c
View 1 Replies
May 7, 2015
Select tbl_name.name,tbl_midname.midname,tbl_last.lastname As name
From tbl_name
inner join tbl_midname on tbl_midname.id=tbl_name.id
inner join tbl_last on tbl_last.id=tbl_name.id
where tbl_name.id='1'
name mid name last name
Pavan Kumar Roy
How to bind all 3 column data in on column.
I need this result
Pavan Kumar Roy
View 1 Replies
Mar 24, 2011
How can I insert 2 DropDownLists into RadioButtonList ?
View 3 Replies
Jan 18, 2010
I have a form with many form fields and controls, with some offering an "other" if a value does not meet the needs for the user. How can I bind the sql insert so that it will take the ddl selection along with the txt field selection for the "other" value? Even if the txt field is empty it should not be a big deal since the ddl would provide something other than null. Since the column in the db does not allow nulls. I'm using asp.net (vb) 3.5 sp1
View 3 Replies
May 7, 2015
i showed two column (Electronics,Photoshop) but i have six. i want to update their checked or unchecked condition in database (0,1) how do i do?
<asp:CheckBox ID="CheckBox1" runat="server" Text="Electronics" />
<asp:CheckBox ID="CheckBox2" runat="server" Text="Photoshop" />
<asp:CheckBox ID="CheckBox3" runat="server" Text="VideoEditing" />
<asp:CheckBox ID="CheckBox4" runat="server" Text="Gaming" />
<asp:CheckBox ID="CheckBox5" runat="server" Text="Coding" />
<asp:CheckBox ID="CheckBox6" runat="server" Text="Miscellaneous" />
View 1 Replies
May 20, 2010
I have a Winform that has fields need to be filled by a user. All the fields doesn't belong to one table, the data will go to Customer table and CustomerPhone table, so i decided to do multiple inserts. I will insert appropriate data to CustomerPhone first then Insert the rest data to Customer table.
View 3 Replies