protected void txtpedido_TextChanged(object sender, EventArgs e) { string id = txtpedido.Text.PadLeft(8, '0'); PedidoDAO pe = new PedidoDAO(); System.Data.DataSet ds = pe.BuscarPedidoxnumeroxforma(id); DataTable dt = ds.Tables[0]; int can = dt.Rows.Count; if (can > 0) { ddlcliente.SelectedValue = dt.Rows[0]["Id_cliente"].ToString(); ddlforma.SelectedValue = dt.Rows[0]["Id_FormaPago"].ToString(); ddlvendedor.SelectedValue = dt.Rows[0]["Id_Vendedor"].ToString(); txtfecha.Text = Convert.ToDateTime(dt.Rows[0]["fechaCheque"]).ToString("yyyy-MM-dd"); txttotal.Text = dt.Rows[0]["Total_Venta"].ToString(); } else { txtmensaje.Text = "El pedido tiene forma de pago al contado o no existe."; string script = "openModal();"; ScriptManager.RegisterStartupScript(this, typeof(Page), "error", script, true); } }