Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5847189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:41:00+00:00 2026-05-22T12:41:00+00:00

i have a datasource, which has an insertparameters, one of which whose type is

  • 0

i have a datasource, which has an insertparameters, one of which whose type is set to Boolean, but while adding it from code behind insertparameters.defaultvalue always return string.

code behind code:

if (e.CommandName == "InsertNew")
{
    TextBox Title = GridView1.FooterRow.FindControl("txtAddTitle") as TextBox;
    TextBox Quote = GridView1.FooterRow.FindControl("txtAddQuote") as TextBox;
    TextBox QuoteLink = GridView1.FooterRow.FindControl("txtAddQuoteLink") as TextBox;
    CheckBox Published = GridView1.FooterRow.FindControl("chkAddBox") as CheckBox;
    TextBox PublishedDate = GridView1.FooterRow.FindControl("txtAddPublishedDate") as TextBox;

    SqlDataSource1.InsertParameters["Title"].DefaultValue = Title.Text;
    SqlDataSource1.InsertParameters["Quote"].DefaultValue = Quote.Text;
    SqlDataSource1.InsertParameters["QuoteLink"].DefaultValue = QuoteLink.Text;
    SqlDataSource1.InsertParameters["Published"].DefaultValue = Convert.ToString(Published.Checked);
    SqlDataSource1.InsertParameters["PublishedDate"].DefaultValue = PublishedDate.Text;
     SqlDataSource1.Insert();
}

and aspx code for sql datasource is:

<InsertParameters>  
    <asp:Parameter Name="Title" Type="String" />  
    <asp:Parameter Name="Quote" Type="String" />  
    <asp:Parameter Name="QuoteLink" Type="String" />  
    <asp:Parameter Name="Published" Type="Boolean" />  
    <asp:Parameter Name="PublishedDate" Type="DateTime" />  
</InsertParameters>

Please reply how should i set the datatype as boolean from code behind.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:41:00+00:00Added an answer on May 22, 2026 at 12:41 pm

    1: Not sure why you are setting DefaultValue instead of the value

    Or

    2: Can you try this:

    SqlDataSource1.InsertParameters["Published"].DefaultValue = Published.Checked==true?"true":"false";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a control on a page that has its Datasource set to
I have a listview which has its datasource changed after update of a search
I have a drop down list box which has one of the values to
I have a datasource that I want to bind to a listview that has
I have a dropdown, I have a datasource, I have AutoPostBack set to true
I have the following code: ListBox.DataSource = DataSet.Tables(table_name).Select(some_criteria = match) ListBox.DisplayMember = name The
I have a DataGridView with its datasource set to a generic list of custom
I have class which has a method that needs to return three DataTables. I
I have a usercontrol which has a combobox inside it. This UserControl is the
I have a ViewModel which encapsulates a datasource which is a domain object. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.