Thanky so much .....
I also found a way to do this...
<div>
<fieldset style="width: 250px">
<legend>Select Time</legend>
From:<asp:DropDownList ID="ddlTimeFrom" runat="server"></asp:DropDownList>
To:<asp:DropDownList ID="ddlTimeTo" runat="server"></asp:DropDownList>
</fieldset>
</div>
code behind:
protected void btnLogin_Click(object sender, EventArgs e)
{
int i = 0;
try
{
List<string> mode = new List<string>();
if (Cashpay.Checked) { mode.Add(Cashpay.Text); }
if (Cardpay.Checked) { mode.Add(Cardpay.Text); }
string payment = string.Join(", ", mode);
string start = ddlTimeFrom.SelectedValue.ToString();
string end = ddlTimeTo.SelectedValue.ToString();
string merge = string.Join(", ", start, end);
//Label1.Text = merge.ToString();
// Extract Image File Name.
string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
//Set the Image File Path.
string filePath = "~/uploads/" + fileName;
//Save the Image File in Folder.
FileUpload1.PostedFile.SaveAs(Server.MapPath(filePath));
string constr = ConfigurationManager.ConnectionStrings["Q_SS_regnConnectionString1"].ConnectionString;
using (SqlConnection conn = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("INSERT INTO Q_SP_Afterlogin (Bussiness_name,city,email,name,toll_free,website_link,payment_mode,Images,Image_name,address,h_open) VALUES (@Bname,@DropDownList2,@mail,@name,@toll,@link,@payment,@Image,@Image_name,@address,@open)", conn))
{
cmd.Parameters.AddWithValue("@Bname", DropDownList1.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@DropDownList2", DropDownList2.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@mail", mail.Text.Trim().ToString());
cmd.Parameters.AddWithValue("@toll", toll.Text.Trim().ToString());
cmd.Parameters.AddWithValue("@link", link.Text.Trim().ToString());
cmd.Parameters.AddWithValue("@name", name.Text.Trim().ToString());
cmd.Parameters.AddWithValue("@address", address.Text.Trim().ToString());
cmd.Parameters.AddWithValue("@payment", payment);
cmd.Parameters.AddWithValue("@Image", filePath);
cmd.Parameters.AddWithValue("@Image_name",fileName);
cmd.Parameters.AddWithValue("@open",merge);
conn.Open();
i = cmd.ExecuteNonQuery();
conn.Close();
}
}
if (i > 0)
{
lab.Text = "Business information is added successfully.";
lab.Visible = true;
}
else
{
lab.Text = "Error while adding..!!";
}