Pregunta

having a problem again... i found a code, but it doesn't work with me... and can't find any related topic here... so then i ask... can anyone do this?

see this link for the image... Please help me do this...

here is our c# code to add and view it on the GridView asp.net

public partial class parypackage : System.Web.UI.Page
{
    SqlConnection PartyConnection = new SqlConnection();
    DataSet partyDataSet = new DataSet();
    SqlDataAdapter partySqlDataAdapter = new SqlDataAdapter();
    private string connect;

    protected void Page_Load(object sender, EventArgs e)
    {
        connect = WebConfigurationManager.ConnectionStrings["PartyConnection"].ConnectionString;
        PartyConnection = new SqlConnection(connect);
        if (!IsPostBack)
        {
            BindGridview();
        }
    }

    protected void BindGridview()
    {
        PartyConnection.Open();
        SqlCommand cmd = new SqlCommand("select * from package", PartyConnection);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        connect = WebConfigurationManager.ConnectionStrings["PartyConnection"].ConnectionString;
        PartyConnection = new SqlConnection(connect);
        PartyConnection.Open();
        SqlCommand addCommand = new SqlCommand("INSERT package (pkgnumber,pkgitems,pkgamount) values ('" + Convert.ToInt32(TextBox1.Text) + "',@Richtextbox ,'" + Convert.ToDouble(TextBox3.Text) + "')", PartyConnection);
        SqlDataReader partySqlDataReader;
        addCommand.Parameters.AddWithValue("@Richtextbox", TextBox2.Text);
        partySqlDataReader = addCommand.ExecuteReader();
        partySqlDataReader.Close();
        PartyConnection.Close();
        BindGridview();
        Response.Redirect("partypackage.aspx");
    }
}
¿Fue útil?

Solución

No, you cant do this with a multi-line textbox. Although you may try some workarounds but it will be too difficult to have the desired result. A textbox captures the plain text inputted to it. Basically, this is the job of text editor to present the user with styling facilities and capturing the data inputted in form of HTML markup. I strongly recommend to use any free text editor instead of a multiline textbox to achieve this easily.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top